Send xhr object along with the data from the response if there is any. Now you'll know if there was a 404 and it won't break on redirects.