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.

Prem Tiwari

Prem Tiwari is the founder of and also a professional developer and a blogger by hobby.

Tags: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.