Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php ajax在firefox中不起作用_Php_Javascript_Codeigniter - Fatal编程技术网

Php ajax在firefox中不起作用

Php ajax在firefox中不起作用,php,javascript,codeigniter,Php,Javascript,Codeigniter,先生,有些问题。我在codeigniter的mac系统上工作 此ajax代码在google chrome上可用,但在firefox上不可用 我的firefox属性是Mozilla/5.0(Macintosh;U;Intel Mac OS X 10.6;en-US;rv:1.9.0.19)Gecko/2010031218 firefox/3.0.19 <script> function showUser(str) { if (str=="") { do

先生,有些问题。我在codeigniter的mac系统上工作 此ajax代码在google chrome上可用,但在firefox上不可用 我的firefox属性是Mozilla/5.0(Macintosh;U;Intel Mac OS X 10.6;en-US;rv:1.9.0.19)Gecko/2010031218 firefox/3.0.19

<script>
function showUser(str)
{ 
    if (str=="")
    {
        document.getElementById("txtHint").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)
        { 
            // alert(xmlhttp.responseText);
            document.location.reload(true);

            document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        }
    }
    xmlhttp.open("POST","http://localhost/first_project/index.php/admin/selectUser/blank?q=" + str,true);
    xmlhttp.send();
}
</script>

函数showUser(str)
{ 
如果(str==“”)
{
document.getElementById(“txtHint”).innerHTML=“”;
回来
}
if(window.XMLHttpRequest)
{//IE7+、Firefox、Chrome、Opera、Safari的代码
xmlhttp=新的XMLHttpRequest();
}
其他的
{//IE6、IE5的代码
xmlhttp=新的ActiveXObject(“Microsoft.xmlhttp”);
}
xmlhttp.onreadystatechange=函数()
{ 
if(xmlhttp.readyState==4&&xmlhttp.status==200)
{ 
//警报(xmlhttp.responseText);
文档。位置。重新加载(true);
document.getElementById(“txtHint”).innerHTML=xmlhttp.responseText;
}
}
open(“POST”http://localhost/first_project/index.php/admin/selectUser/blank?q=“+str,正确);
xmlhttp.send();
}
请给我一个解决方案。 提前谢谢。

这毫无意义

        document.location.reload(true);  <-- reload the document

        document.getElementById("txtHint").innerHTML=xmlhttp.responseText;  <--set text

控制台中的错误消息是什么?Firefox 3.0.19?您是否考虑过将其更新为Firefox 16看看如何在jquery@x3ro中使用更简单的ajax一些人可能有要求,他们需要支持旧浏览器,出于某些原因,有些公司使用旧浏览器,如firefox3、IE7等@JonTaylor我知道有人想要支持旧浏览器(我自己已经为古董IE版本优化了很长一段时间),但是他的问题是否反映了这样一个要求呢没有,我建议更新。为什么我要对这样一个轻松提出的问题投入更多的思考,特别是如果我真的不能确定他是否需要Fx 3.0.19?没有jQuery,因此你的答案很糟糕:)
xmlhttp.onreadystatechange = function () { 
    if (xmlhttp.readyState==4) {
        if (xmlhttp.status==200) { 
            // alert(xmlhttp.responseText);
            document.location.reload(true);
            //document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        } else {
            //console.error(xmlhttp.status + "\t" + xmlhttp.statusText);
            alert(xmlhttp.status + "\t" + xmlhttp.statusText);
        }
    }
};