/ Published in: JavaScript
Simulate the $GET array from php in javascript to get url parameters this way: url= http://localhost/?var1=example $GET['var1'] will return "example"
Just copy and paste the code.
Expand |
Embed | Plain Text
var $_GET=new function(){ var fullUrl=window.location.href.split('?'); var urlParams=fullUrl[1].split('&'); $_GET=new Array(); for(i=0;i<=urlParams.length-1;++i){ var param=urlParams[i].split('='); var name=param[0]; var value=param[1]; $_GET[name]=value; } return $_GET; }
You need to login to post a comment.
