ajax异步出错 当用ajax的时候,进行到open操作的时候同步不会有显示网页错误,但是异步就会出现网页出错的问题这是怎么回事呢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 异步加载延迟的问题,你是不是在ajax的open函数后面使用了通过了ajax加载的数据... 那么多开源良好的js框架,为什么不用呢?jquery中那是相当的简单。你的问题是不是获取方式的影响呢?get,post alert("get"); this.xmlReq.open(this.method, this.url,this.isAsync);alert("open"); this.xmlReq.send(this.data);在这里我使用了这两个alert,当alert("get");之前不会有(网页错误提示)但是当open操作之后,即显示alert("open");之后就会有(网页错误提示) this.init = function() { var owner = this; this.createXMLRequest();//得到XMLHTTP对象 if(this.isAsync){ this.xmlReq.onreadystatechange = function() { alert("onreadystatechange"); owner.stateChange.call(owner);//调用stateChange方法,参数为owner }; } }上个代码中回调函数通过this.isAsync这个值的真假来判断是否执行this.xmlReq.onreadystatechange,当异步需要执行的时候,在执行了this.xmlReq.open(this.method, this.url,this.isAsync);就网页报错了 请问这里的特效代码怎么改? 如何编辑节点属性?(javascript) C#怎么调用JS变量? js 页面滚动问题 怎么找到页面上的一个radio button 关于表单验证radio的问题!急,菜鸟! 得到表单的属性值 小问题帮忙啦 一个小小的问题,送上20分 点击单选项显示或隐藏的问题? ajax异步出错 让弹出的层 用鼠标能拖动
alert("get");
this.xmlReq.open(this.method, this.url,this.isAsync);
alert("open");
this.xmlReq.send(this.data);在这里我使用了这两个alert,当alert("get");之前不会有(网页错误提示)
但是当open操作之后,即显示alert("open");之后就会有(网页错误提示)
this.init = function() {
var owner = this;
this.createXMLRequest();//得到XMLHTTP对象
if(this.isAsync){
this.xmlReq.onreadystatechange = function() {
alert("onreadystatechange");
owner.stateChange.call(owner);//调用stateChange方法,参数为owner
};
}
}上个代码中回调函数通过this.isAsync这个值的真假来判断是否执行this.xmlReq.onreadystatechange,当异步需要执行的时候,在执行了this.xmlReq.open(this.method, this.url,this.isAsync);就网页报错了