karax
karax copied to clipboard
The callback to ajax can give a status of ``0`` due to xhr
This case should be handled, see here https://stackoverflow.com/questions/36416389/why-does-my-xmlhttprequest-have-readystate-4-but-status-0
How should it be handled though? A status of 0 just means a (client-side) error, and according to that StackOverflow post the easiest way to figure out what the error was is to look at the JS console and see what it says.
(And yes I realize it's been over three years since you wrote this, so you may not even remember why you ran into this issue :laughing:)
From a quick look at the thread, it seems like the best option might be to add an onerror
handler to the call that throws an exception.
I've investigated this a bit more, and it seems there is no way to get details of the error from onerror
so it is a bit useless. If you need to handle this case just check status == 0
in your callback.
If you have any other suggestions for how to approach this better please reopen the issue