Get URL Parameters in Javascript

Spread the love

This is little set of code piece to get url parameters in javascript, Getting URL’s parameter in client side language like javascript is not as simple in server side language . So you need to code  manually program in javascript which concentrate URL’s parameter and you can without much of a stretch access by it’s name.

get parameter from url javascript, javascript get all url parameters, javascript get url parameter value by name, javascript get url path, javascript get url query string, jquery get parameter from url

Here is the function.

The above function written in pure javascript you only need to pass parameter name which you want to extract and URL, If URL is not set it’ll automatically set current URL, With the help of RegExp and decodeURIComponent function in javascript it return query string by it’s name. See example.

Leave a Reply

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