Reputation: 3927
After upgrading jquery from 1.4.2 to 1.4.4 I am now getting this error "Illegal operation on WrappedNative prototype object" when trying to use $.ajax()
Here is the simplified code:
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('', {});
Anyone have any idea what the problem could be?
Upvotes: 3
Views: 971
Reputation: 82903
The problem is with the line where you are assigning window.location to url. It should be window.location.href.
if (url == '') {
url = window.location.href;
}
I am not sure about the reasons though. Will update the post once I figure out.
Upvotes: 3