How to check for redirects on ajax calls?

Question!

I was looking at this answer and some other answers http://stackoverflow.com/questions/199099/how-to-manage-a-redirect-request-after-a-jquery-ajax-call/199156#199156

I can not get this to work. i check the XMLHttpRequest object in both success and complete. In both cases when there is a redirect instead of getting a 302 i get a 200 and the html for that page. How do i make it actually report the 3xx redirect instead of skipping ahead and giving me a 200?



Answers

The problem most likely lies in your back-end code not returning the correct status. jQuery gives the same status it gets from the back-end so I would start by: posting code for us to see (jQuery and whatever your backend is) and looking at your server logs to see what is happening there.

By : rfunduk


This video can help you solving your question :)
By: admin