Tuesday, 20 August 2013

Ajax address bar variable issue

Ajax address bar variable issue

I have a site that places a variables into the address bar.
www.mywebsite.com/index.php?user=288
I simply use usernum = $_GET["user"]; to assign the variable.
I can use this variable no problem, but when it comes to the ajax within
that page getting the variable - it just won't acknowledge it.
How can I get ajax to get the address bar variable too?
----NEW CONTENT--
I'm new to ajax so don't be harsh
function loadXMLDoc(pageName)
{
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("centreCont").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","../profile/" + pageName + ".php",true);
xmlhttp.send();
}

No comments:

Post a Comment