Let's say I have this url: www.example.com/test.php?page=4
How do i retrieve the value of $_GET['page'] with jQuery? o_O
Let's say I have this url: www.example.com/test.php?page=4
How do i retrieve the value of $_GET['page'] with jQuery? o_O
If you don't have jQuery or you don't want to use a plugin, you can use this code from netlobo.com:
function gup( name )
{
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];
}
then use it as follows:
var pageNumber = gup( 'page' );