Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/422.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
当我输入textbox时,我的Ajax调用不起作用 函数showHint(str){ 如果(str.length==0){ document.getElementById(“txtHint”).innerHTML=“”; 返回; } if(window.XMLHttpRequest){//IE7+、Firefox、Chrome、Opera、Safari的代码 xmlhttp=新的XMLHttpRequest(); }else{//IE6、IE5的代码 xmlhttp=新的ActiveXObject(“Microsoft.xmlhttp”); } xmlhttp.onreadystatechange=函数(){ if(xmlhttp==4&&xmlhttp.status==200){ document.getElementById(“txtHint”).innerHTML=xmlhttp.responseText; } } open(“GET”、“gethint.php?q=“+str,true”); xmlhttp.send(); } 名字: ------------------------------------- 第一_Php_Javascript_Ajax - Fatal编程技术网

当我输入textbox时,我的Ajax调用不起作用 函数showHint(str){ 如果(str.length==0){ document.getElementById(“txtHint”).innerHTML=“”; 返回; } if(window.XMLHttpRequest){//IE7+、Firefox、Chrome、Opera、Safari的代码 xmlhttp=新的XMLHttpRequest(); }else{//IE6、IE5的代码 xmlhttp=新的ActiveXObject(“Microsoft.xmlhttp”); } xmlhttp.onreadystatechange=函数(){ if(xmlhttp==4&&xmlhttp.status==200){ document.getElementById(“txtHint”).innerHTML=xmlhttp.responseText; } } open(“GET”、“gethint.php?q=“+str,true”); xmlhttp.send(); } 名字: ------------------------------------- 第一

当我输入textbox时,我的Ajax调用不起作用 函数showHint(str){ 如果(str.length==0){ document.getElementById(“txtHint”).innerHTML=“”; 返回; } if(window.XMLHttpRequest){//IE7+、Firefox、Chrome、Opera、Safari的代码 xmlhttp=新的XMLHttpRequest(); }else{//IE6、IE5的代码 xmlhttp=新的ActiveXObject(“Microsoft.xmlhttp”); } xmlhttp.onreadystatechange=函数(){ if(xmlhttp==4&&xmlhttp.status==200){ document.getElementById(“txtHint”).innerHTML=xmlhttp.responseText; } } open(“GET”、“gethint.php?q=“+str,true”); xmlhttp.send(); } 名字: ------------------------------------- 第一,php,javascript,ajax,Php,Javascript,Ajax,尝试更改此行 <form> FirstN<input type="text" onkeyup="return showHint(this.value);" size="20" /> </form> 到 我认为错误将发生在 if (xmlhttp == 4 && xmlhttp.status == 200) { Should BE if (xmlhttp.readyState==4 && xmlhttp.status==

尝试更改此行

<form>
    FirstN<input type="text" onkeyup="return showHint(this.value);" size="20" />
</form>


我认为错误将发生在

if (xmlhttp == 4 && xmlhttp.status == 200) {
Should BE
if (xmlhttp.readyState==4 && xmlhttp.status==200)

---------------------------

if (strtolower($q)==strtolower(substr($a[$a],0,strlen($q))))
Should BE
if (strtolower($q)==strtolower(substr($a[$i],0,strlen($q))))
这里什么是$a[$a]。。?那么,您喜欢执行for循环吗

strtolower(substr($a[$a],0,strlen($q))))

用于($i=0;$i为什么要这样做?一个好的程序员会悄悄地添加它,并且不需要返回语句,除非你需要取消事件,你可以通过事件对象本身来完成。愿意打赌这个答案不会神奇地使海报的代码工作。@Karthikeyan的
我是什么?
一个知道的人s您的答案不正确?@user741429请回答我在您的问题下的评论。谢谢!抱歉epascarello我很抱歉Buddy什么不起作用?当您查看Fiddler或Firebug时,您是否看到服务器上有Ajax调用?您是否在控制台中看到错误?错误是在服务器上还是在客户端?您是否厌倦了调用您想要的url你是直接在浏览器中进行Ajax调用吗?这行得通吗?你需要确定它的中断点。检查Firebug的调用和响应,代码很好。认为我们这里有赢家了!:)
if (strtolower($q)==strtolower(substr($a[$i],0,strlen($q))))
if (xmlhttp == 4 && xmlhttp.status == 200) {
Should BE
if (xmlhttp.readyState==4 && xmlhttp.status==200)

---------------------------

if (strtolower($q)==strtolower(substr($a[$a],0,strlen($q))))
Should BE
if (strtolower($q)==strtolower(substr($a[$i],0,strlen($q))))
strtolower(substr($a[$a],0,strlen($q))))
  for($i=0; $i<count($a); $i++)
    {
     if (strtolower($q)==strtolower(substr($a[$a],0,strlen($q))))
  for($i=0; $i<count($a); $i++)
    {
     if (strtolower($q)==strtolower(substr($a[$i],0,strlen($q))))