gpt4 book ai didi

javascript - 损坏的 jQuery 1.4.2 功能?

转载 作者:行者123 更新时间:2023-11-29 20:21:34 25 4
gpt4 key购买 nike

此代码在从 1.3.2 升级之前有效。到 1.4.2,现在我收到这个错误,我不知道该怎么办...:

jQuery.ajax({
type: 'post',
url: '/ajax/store/product/getAssocDetail.ph',
dataType: 'json',
data: {
//productId: (document.location+"").split("=")[1],
vehicleId: id
},
success: function () {/*
if (r.length > 0) {
console.log(r.length);
for (var i = 0; i < r.length; i++) {
jQuery('#condition-'+i+'-price').val(r[i].price);
jQuery('#condition-'+i+'-bid').val(r[i].bid);/*
if (parseInt(r[i].on_amazon) == 1) {
jQuery('#on_amazon-'+i+'-yes').attr('checked', 'checked');
} else {
jQuery('#on_amazon-'+i+'-no').attr('checked', 'checked');
}
console.log('[value='+r[i].on_amazon+']');
console.log(jQuery('#condition-'+r[i].condition_id+'-on_amazon').filter('[value='+r[i].on_amazon+']'));
jQuery('#condition-'+r[i].condition_id+'-on_amazon').filter('[value='+r[i].on_amazon+']').attr('checked', true);
}

jQuery('#assocation-detail').show();
} else {
triggerNotification('x', 'Could not find any assocation data');
}*/
},
error: function () {
//document.triggerNotification('x', 'Unable to process your request, ajax file not found');
return false;
}
});

uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame :: http://internal.ikeyless/js/jquery/jquery-1.4.2.min.js :: f :: line 132" data: no]

Line 0

更新

错误似乎出现在未压缩的 jQuery 1.4.2 的第 5437 行 (http://code.jquery.com/jquery-1.4.2.js)

    function add( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction(value) ? value() : value;
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
}

更新

问题是通过 ajax 发布的值之一是一个 dom 节点 :-\

最佳答案

The issue was that one of the values being posted via ajax was a dom node :-\

为什么会这样:

jQuery 正在尝试将节点序列化为通用 {} 样式的对象查找。它使用 for..in 循环获取节点的每个属性,包括 appendChild 等 DOM 方法。 add 函数引用检查值是否为函数,如果是,则调用它。方法是一个函数,因此它调用 node.appendChild 作为普通函数,没有将 this 设置为指向实际的 Node 实例。这会导致特征 XPC 错误。

jQuery 1.3 没有能够将可调用函数传递到参数映射中的(相当无意义的 IMO)功能,因此您不会收到此错误。序列化 DOM 节点仍然不明智,但它会默默地失败而不是崩溃。

关于javascript - 损坏的 jQuery 1.4.2 功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3761269/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com