jQueryAjax从1.4.2升级到1.4.4后出现问题
在将jquery从1.4.2升级到1.4.4之后,我现在在尝试使用$.ajax()时遇到了这个错误“WrappedNative prototype对象上的非法操作” 以下是简化代码:jQueryAjax从1.4.2升级到1.4.4后出现问题,jquery,Jquery,在将jquery从1.4.2升级到1.4.4之后,我现在在尝试使用$.ajax()时遇到了这个错误“WrappedNative prototype对象上的非法操作” 以下是简化代码: function doAjax(url, data, complete) { if (data == null) { var data = {}; } if (complete == null) { var complete = function(){
function doAjax(url, data, complete) {
if (data == null) {
var data = {};
}
if (complete == null) {
var complete = function(){};
}
if (url == '') {
url = window.location;
}
data.ajax = 1;
$.ajax({
type: 'POST',
url: url,
cache: false,
data: data,
dataType: 'script',
success: function(data, textStatus){
},
error: function(xhr, textStatus, errorThrown) {
doAlert('An error occurred: '+xhr.responseText);
},
complete: complete
});
}
doAjax('', {});
有人知道问题出在哪里吗 问题在于将window.location分配给url的行。它应该是window.location.href
if (url == '') {
url = window.location.href;
}
但我不确定原因是什么。
一旦我弄明白了,我会更新帖子的