How do I read the value of ID with a url similar to the following?
http://intranet/page.aspx?id=10
How do I read the value of ID with a url similar to the following?
http://intranet/page.aspx?id=10
function gup( name ) //stands for get url param
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}
var my_param = gup( 'id' );
Here is the jsfiddle that uses a variable with a static url to test the output. This is done without using jQuery, however.
That link helped me to do the same, has jQuery and JavaScript examples.