以下脚本可以在我自己的服务器上运行,但在我将其上传到我的webhost后,它不会将变量发送到php文件。是什么导致了这个问题?
(警告框可以显示变量,但php脚本使用空的vars运行)
剧本:
function showHQ(str)
{
var hq_kat = document.getElementById('hq_kat').value;
var hq_terulet = document.getElementById('hq_terulet').value;
var hq_rend = document.getElementById('hq_rend').value;
var hq_megj = document.getElementById('hq_megj').value;
var hq_r = document.getElementById('hq_r').value;
if (str=="")
{
document.getElementById("results").innerHTML="";
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("results").innerHTML=xmlhttp.responseText;
}
}
var queryString = "?hq_kat=" + hq_kat ;
queryString += "&hq_terulet=" + hq_terulet;
queryString += "&hq_rend=" + hq_rend;
queryString += "&hq_megj=" + hq_megj;
queryString += "&hq_r=" + hq_r;
xmlhttp.open("GET", "search.php" + queryString, true);
xmlhttp.send();
//alert(queryString);
}
{
var hq_kat = document.getElementById('hq_kat').value;
var hq_terulet = document.getElementById('hq_terulet').value;
var hq_rend = document.getElementById('hq_rend').value;
var hq_megj = document.getElementById('hq_megj').value;
var hq_r = document.getElementById('hq_r').value;
if (str=="")
{
document.getElementById("results").innerHTML="";
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("results").innerHTML=xmlhttp.responseText;
}
}
var queryString = "?hq_kat=" + hq_kat ;
queryString += "&hq_terulet=" + hq_terulet;
queryString += "&hq_rend=" + hq_rend;
queryString += "&hq_megj=" + hq_megj;
queryString += "&hq_r=" + hq_r;
xmlhttp.open("GET", "search.php" + queryString, true);
xmlhttp.send();
//alert(queryString);
}