How To Get Query String Values In JavaScript




We are familiar with getting Query String Values in Asp.Net code behind. But for getting the Query String Values in Javascript just follow these steps.

Get Query String Values In JavaScript, Get Query String Values In JQuery, Query String In JavaScript, Query String Values In JQuery, Asp.Net, MVC, PHP, HTML, Obtain Query String Values In JavaScript

By writing down the above code we can get the Query String Values In JavaScript.



function FetchQueryString(regKey)
{
                 
 regKey = regKey.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");
 
 var regexValue = new RegExp("[\\?&]"+regKey+"=([^&#]*)");
 
 var result = regexValue.exec(window.location.href);
 
 if(result == null)
 
 alert("The parameter is null");
 
 else alert(result[1]);
 
}