IE 8 中 AJAX 不一致?
这是我的代码:(更确切地说,其中的狡猾部分)
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
var requisicao=new XMLHttpRequest();
} else {
var requisicao=new ActiveXObject("Microsoft.XMLHTTP");
}
好的。有时这工作正常,但有时 IE 中的 Javascript 调试器会告诉我:
对象不支持此属性或方法 model.js 第 59 行字符 3
这相当于......
var requisicao=new XMLHttpRequest();
令我烦恼的是,有时 IE 8 接受此属性并继续,但有时它会阻塞并且无法工作?
欢迎任何帮助
提前致谢
This is my code: (rather, the dodgy part thereof)
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
var requisicao=new XMLHttpRequest();
} else {
var requisicao=new ActiveXObject("Microsoft.XMLHTTP");
}
Ok. Sometimes this works fine, but sometimes the Javascript Debugger in IE tells me this:
Object doesn't support this property or method model.js line 59 character 3
Which amounts to....
var requisicao=new XMLHttpRequest();
What bugs me is the fact that sometimes IE 8 accepts this and moves on but sometimes it chokes and doesn't work?
Any help is welcome
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:显然,在这种情况下,Internet Explorer 的行号是正确的。这似乎是 Internet Explorer 8 的常见问题。这里有一个潜在的解决方案:Ajax 应用程序适用于一些浏览器,而不是其他浏览器。
以下是代码的相关部分:
不幸的是,Internet Explorer 的行号并不总是准确的,因为它们基于其自身的代码内部序列化。错误消息可能来自不同的行(希望在第 59 行附近)。我会检查您在对象上调用方法的位置,该方法可能因任何原因设置为不同的值。< /删除>Edit: Apparently, in this case, Internet Explorer's line number is correct. This seems to be a common problem with Internet Explorer 8. There's a potential solution here: Ajax app works in some browers, not others.
Here is the relevant part of the code:
Unfortunately, Internet Explorer's line numbers aren't always accurate, since they are based on its own, internal serialization of your code. The error message is probably coming from a different line (hopefully near line 59).I would check for places where you are calling a method on an object that could be set to different values for whatever reason.