xmlhttp-> open不会打开php文件

时间:2013-05-10 18:53:21

标签: php javascript xmlhttprequest

我的代码似乎没有使用xmlhttp-> open函数到达PHP文件。该函数与它所连接的字段一起使用,但一旦它发送,它根本不会激活PHP文件。

<script  type="text/javascript">
function showCity(str)
{
if (str=="")
  {
  document.getElementById("top_banner_id").innerHTML="";
  return;
  } 

  xmlhttp=new XMLHttpRequest();

  xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {

    document.getElementById("top_banner_id").innerHTML=xmlhttp.responseText;
    }
  }

  xmlhttp.open("GET","townGrab.php?q="+str,true);
  xmlhttp.send();
}
</script>

这是我在Chrome控制台中遇到的错误。我通过将源文件更改为最新版本的jQuery来修复事件处理程序错误。但是,仍有内部服务器错误需要处理:

Error in event handler for 'undefined': IndexSizeError: DOM Exception 1 Error: Index or size was negative, or greater than the allowed value.
    at P (chrome-extension://mgijmajocgfcbeboacabfgobmjgjcoja/content_js_min.js:16:142)
    at null.<anonymous> (chrome-extension://mgijmajocgfcbeboacabfgobmjgjcoja/content_js_min.js:18:417)
    at chrome-extension://mgijmajocgfcbeboacabfgobmjgjcoja/content_js_min.js:1:182
    at miscellaneous_bindings:288:9
    at chrome.Event.dispatchToListener (event_bindings:390:21)
    at chrome.Event.dispatch_ (event_bindings:376:27)
    at chrome.Event.dispatch (event_bindings:396:17)
    at Object.chromeHidden.Port.dispatchOnMessage (miscellaneous_bindings:254:22) event_bindings:380
GET website url here (Internal Server Error) 

0 个答案:

没有答案