What happens if the browser receives a redirect response to an ajax request?
What happens if the browser receives a redirect response to an ajax request?
The ajax-request will follow that redirect afaik. The actual content (.responseText, .responseXML) will be the content from the page you are redirected to.
You might be able to intercept the redirect (status-code, location-header) on readyState 2 or 3, but not sure about it.
TLDR: it's doable with fetch.
More info here: https://github.com/axios/axios/issues/932#issuecomment-515229573