javascript - CORS synchronous requests not working in firefox -
the official documentation of jquery ( async ajax section ) says that:
cross-domain requests , datatype: "jsonp" requests not support synchronous operation.
however works in recent browsers firefox version >= 20. here 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 have clue why happening ?
update: ive tested both jquery , vanilla xhr error same
[exception... "a parameter or operation not supported 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); } });
Comments
Post a Comment