Get URL Variables Using JavaScript

Prem Tiwari - - Code Snippets

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

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.

About: Prem Tiwari

Prem Tiwari is the founder of and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies.

Tags: , , , ,