The official documentation of jQuery ( async ajax section ) says that:
Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation.
However this works in all recent browsers but firefox version >= 20. Here is the type of calls i'm making:
$.ajax({
type : "GET",
async: false,
dataType : "text",
url : link,
xhrFields: { withCredentials: true },
success: function(response){
console.log("success ");
},
error: function(error){
console.error(error);
}
});
Does anyone have a clue why this is happening ?
UPDATE: Ive tested both with jQuery and vanilla XHR the error is always the same
[Exception... "A parameter or an operation is not supported by the underlying object" code: "15" nsresult: "0x8053000f (InvalidAccessError)"
Use beforeSend
instead of xhrField
.
$.ajax({
type : "GET",
async: false,
dataType : "text",
url : link,
beforeSend: function(xhr) {
xhr.withCredentials = true;
},
success: function(response){
console.log("success ");
},
error: function(error){
console.error(error);
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With