I am using HTML5, jQuery 1.6.1, jQuery Mobile 1.0.1.
I am using below code to make an Ajax request. It’s working fine in Chrome but I got the below error while testing in Firefox 14.0.1.
Use of XMLHttpRequest’s withCredentials attribute is no longer supported in the synchronous mode in window context.
Code:
$.ajax({
type: "GET",
dataType: "json",
async: false,
beforeSend: function (xhr){
xhr.setRequestHeader('Authorization', make_base_auth(UserId, Password));
},
xhrFields: {
withCredentials: true
},
success:function(data){
console.log("Success");
},
error:function(xhr,err){
console.log("Failed" );
}
});
Please help me out on this.
The solution is simple : don’t use
async: falsein$.ajax.It’s deprecated in newer version and you don’t need it. It was always a bad idea to use it. Execute what you need to do with result from the success callback (just like your
console.log).From the documentation (1.8) :