jQuery ajax BUG:object doesn't support this property or method_jquery

问题:jQuery控件的一个BUG
使用$.ajax时出现的错误,IE7下才会出错,IE6,IE8都正常。错误提示如下图:

官方论坛上的说明:

http://forum.jquery.com/topic/object-doesn-t-support-this-property-or-method-from-jquery-1-4-1-in-ie7-only
http://dev.jquery.com/ticket/6498
http://dev.jquery.com/ticket/6314

解决方案:
修改jquery-1.4.2.js。

论坛上有人提出的修改方式,我测试过可行。

复制代码 代码如下:

Hi, I found this seems to relate to jQuery bug 6314 (http://dev.jquery.com/ticket/6314). In IE7, if "Enable native XMLHTTP support" is checked (under Tools > Internet Options > Advanced tab > inside the security section) then this error shows up. Unchecking/disabiling the option seems to resolve the error.

However, since I cannot tell all website viewers to uncheck that option, then the following code also seems to resolve the issue:
In non-minified jQuery, find the lines:
try {
var oldAbort = xhr.abort;
xhr.abort = function() {
if ( xhr) {
oldAbort.call( xhr );
}

onreadystatechange( "abort" );
};
} catch(e) { }

replace it with the following code:
try {
var oldAbort = xhr.abort;
xhr.abort = function() {
if ( xhr) {
if (oldAbort.call === undefined) {
oldAbort();
} else {
oldAbort.call( xhr );
}
}

onreadystatechange( "abort" );
};
} catch(e) { }

I believe the issue is as stated by other users in this forum, that the xhr (XMLHTTP) object is a native IE object, so the abort function on the xhr.abort function does not support call.

时间: 2024-09-08 12:38:47

jQuery ajax BUG:object doesn't support this property or method_jquery的相关文章

js报错 Object doesn't support this property or method的原因分析_javascript技巧

js报错: Object doesn't support this property or method 问题原因: 1:js代码用了javascript关键字 2:方法名和表单或者div form名冲突 3.button中有name="submit" 4.上传图片时提示:Object doesn't support this property or method 原因:服务器上安装的AspJpeg的版本低于1.4版. 解决方法:安装1.4或以上版本的AspJpeg组件. 我也遇到这个

object doesn’t support this property or method

一段看不出有任何问题的代码, 在ie下报错:"object doesn't support this property or method".  代码如下 复制代码 function foo(obj) {   productTree = obj.toString();   document.getElementById('productTree').innerHTML = productTree; } 开始, 还以为错误是指obj的toString方法, 绕了半天弯路, 无果.. 后来

jQuery ajax serialize() 提交表单数据

jQuery ajax中数据以键值对(Key/Value)的形式发送到服务器,使用ajax提交表单数据时可以使用jQuery ajax的serialize() 方法表单序列化为键值对(key1=value1&key2=value2-)后提交.serialize() 方法使用标准的 URL-encoded 编码表示文本字符串.下面是使用serialize()序列化表单的实例: jQuery ajax原型:  代码如下 复制代码 $.ajax({    type: "POST",

jQuery Ajax 上传文件处理方式介绍(推荐)_jquery

AJAX 是一种与服务器交换数据的技术,可以在补充在整个页面的情况下更新网页的一部分. 下面的表格列出了所有的 jQuery AJAX 方法: jQuery Ajax在web应用开发中很常用,它主要包括有ajax,get,post,load,getscript等等这几种常用无刷新操作方法,接下来通过本文给大家介绍jquery ajax 上传文件处理方式. FormData对象 XMLHttpRequest Level 2添加了一个新的接口FormData.利用FormData对象,我们可以通过J

firefox下jquery ajax返回object XMLDocument处理方法

 使用jquery ajax处理struts2 返回json类型的时候,ajax执行成功返回结果为object XMLDocument,解决方法如下 在firefox下使用jquery ajax处理struts2 返回json类型的时候,ajax执行成功返回结果为 [object XMLDocument].    处理办法:在getWriter.print():前面加上一行代码  代码如下: ServletActionContext.getResponse().setContentType("t

firefox下jquery ajax返回object XMLDocument处理方法_jquery

在firefox下使用jquery ajax处理struts2 返回json类型的时候,ajax执行成功返回结果为 [object XMLDocument]. 处理办法:在getWriter.print():前面加上一行代码 复制代码 代码如下: ServletActionContext.getResponse().setContentType("text/html;charset=UTF-8");

jQuery ajax:一些细节以及主函数扩展出来的方法

上一篇文章,讲解了jQuery.ajax函数.这篇文章将其他一些细节补充完.下一篇文章则开始讲解,jQuery 是如何将script动态载入.XMLHttpRequest.JSONP一起包装进jQuery.ajax里的. jQuery.ajaxSetup 我们可以从主函数看出,参数是通过jQuery.ajaxSetup产生的: // 通过jQuery.ajaxSetup改造参数对象 s = jQuery.ajaxSetup( {}, options ), 那么 jQuery.ajaxSetup在

jQuery ajax:将类AJAX方法包装起来

上一篇文章,将jQuery.ajax中的一些细节补充完.这篇文章讲解如果将类AJAX方法都包装进jQuery.ajax 中.下篇文章则讲解各预过滤器和分发器的细节. 为什么要包装起来? 我们知道,古老的 XMLHttpRequest出于同源策略考虑,是不支持跨域的.所以,在前端想动态加载跨域Javascript脚本,通常是 使用被称为Script DOM Element的方案,如: var scriptElem = document.createElement ("script");

jQuery ajax:Baidu ajax

你没有看错标题,本文的确是在讲Baidu ajax,不过是很久很久以前的版本了. 由于jQuery ajax 模块有800+行,而核心函数jQuery.ajax就有380+行,直接分析这段代码很容易被代码逻辑弄晕. 所以 我们先分析一段简单的ajax代码,来自早期的百度七巧板项目. 通过这个来先复习一遍ajax的知识. baidu.ajax.request分离版 /** * 发送一个ajax请求 * @author: allstar, erik, berg * @name ajax.reques