I need some help getting the included ajax script's xmlhttp.open() to target a php code within the same page --something like $_SERVER[PHP_SELF]
here is the script:
<script type="text/javascript">
function showResult3(strss)
{
if (strss.length==0)
{
document.getElementById("livesearch3").innerHTML="";
document.getElementById("livesearch3").style.border="0px";
return;
}
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("livesearch3").innerHTML=xmlhttp.responseText;
document.getElementById("livesearch3").style.border="1px solid #A5ACB2";
}
}
xmlhttp.open("GET","q="+strss,true);//$_SERVER[PHP_SELF]
xmlhttp.send();
}
</script>
I want to pass the variable $q to a php code in the same page as the code above. I know typically the xmlhtpp.open() need a url which tent to be an external one. I'm hoping that there is a work around.
I appreciate any help!