This tutorial will explain how to get URL variables using JavaScript. This will help you when you want to do some operation based on the URL variables.
Get URL Variables Using JavaScript
Use the below Javascript code to print the URL variable. You can use the getQueryVariable()
function in your JavaScript to get the variable data from URL. You only need to pass the variable as parameter in getQueryVariable()
function.
If your website URL like this http://www.your-site-url.com/example.php?user_data=128
Calling getQueryVariable(“user_data”); // it would return the 128
Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool JavaScript tutorials.
The post Get URL Variables Using JavaScript appeared first on FreeWebMentor.
This post first appeared on Programming Blog Focused On Web Technologies, please read the originial post: here