How can I include address bar variable in this javascript line? -
can please tell me how can add in address bar variable javascript?
the website address reads: www.example.com/index.php?user=74
and javascript needs include 'user = 74' is:
xmlhttp.open("get","../profile/" + pagename + ".php",true);
function get_query(){ var url = location.href; var qs = url.substring(url.indexof('?') + 1).split('&'); for(var = 0, result = {}; < qs.length; i++){ qs[i] = qs[i].split('='); result[qs[i][0]] = decodeuricomponent(qs[i][1]); } return result; } xmlhttp.open("get","../profile/" + pagename + ".php?user=" + get_query()['user'],true);
Comments
Post a Comment