我正在构建一个使用的Web应用程序,我认为它是一个简单的Ajax
函数。该应用程序在办公室中的五台计算机中有四台很好用,但是一台计算机有一个问题达到了200的状态。它也不是一个特定于浏览器的问题。他在IE
,Chrome
,Firefox
和&所有四种浏览器都有Safari
和同样的问题。
在产品投入全面生产之前,我们必须在结束时弄清楚并纠正这个问题。在此之后,我们无法绕过纠正客户的计算机或试图向客户解释他们的计算机是否有问题。
所有想法?
注意:
Ajax
函数,查询PHP
脚本和数据库全部开启
同一台服务器。代码:
// Pull the information from the database
get_variables = 'action=grabUnitInformation'+
'&identifier='+identifier;
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){
var receiver = eval('(' + xmlhttp.responseText + ')');
// Process JSON
alert("Got the info");
}else{
alert("Ready state: "+xmlhttp.readyState);
alert("Status: "+xmlhttp.status);
}
}
xmlhttp.open("GET", "http://www.mysite.com/search.php?"+get_variables, true);
xmlhttp.send();
答案 0 :(得分:0)
好的,我找到了一种方法让它发挥作用。
包含Ajax
脚本,查询PHP
脚本和数据库的页面都在同一台服务器上。所以..........
而不是绝对网址:
xmlhttp.open("GET", "http://www.mysite.com/search.php?"+get_variables, true);
我将其更改为相对网址:
xmlhttp.open("GET", "search.php?"+get_variables, true);
现在好了。可能不是最好的方式,但我还没有找到任何其他答案或帮助。