我的AJAX无法正常工作,我无法弄清楚原因.我错过了什么?
ReferenceError:未定义xmlhttp @ javascript.js:5
function insapts(pin){
if (window.XMLHttpRequest){ xmlhttpp=new XMLHttpRequest(); }else{ xmlhttpp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttpp.onreadystatechange=function(){
if(xmlhttpp.readyState==4 && xmlhttpp.status==200){
document.getElementById('apttimeins').innerHTML = xmlhttp.responseText;
}
}
var url = "bridge3.php?pin="+pin;
xmlhttpp.open("GET",url,false);
xmlhttpp.send(null);
}
Run Code Online (Sandbox Code Playgroud)
你有一个错字.该XMLHttpRequest对象与局部变量名称创建xmlhttpp.
更改
xmlhttp.responseText;
Run Code Online (Sandbox Code Playgroud)
至
xmlhttpp.responseText;
// ^ missing p
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16192 次 |
| 最近记录: |