I have several ajax requests I'm making using jQuery. The requests "go through" fine in Chrome, but in FireFox they all return as an error. The error isn't anything, just "error." It's not a cross-origin request.
They work in FF if I set async: false
which obviously I don't want to do. The only workaround I found was to wrap the calls in a setTimeout()
function with a 1 ms delay. 1 ms!! And the calls work as expected.
The problem is similar to another question, but I want to know why it fails without setTimeout()
. Is there another option I'm missing?
setTimeout(function () {
$j.ajax({
url: '/same/server/',
method: method,
headers: {
"Content-Type": "application/json",
"Accept": "application/json"
},
data: data,
error: function (err, status, errorThrown) {},
success: function (data) {}
}
})
}, 1)