I'm trying to figure out how to recognize when an HTTP redirect comes back from an Ajax request. Here is my submission code:
On the serverside, a request to "whatever.com/export/foo'" generates a file and then returns an HTTP redirect to that file. Without Ajax, the browser follows the redirect and gives me an "open/save" dialog as you'd expect.
debug.popup(response.responseText); //show the server response in a dialog
With Ajax, I was expecting the success function above to output an object with status=302 and a redirect URL which I could push to location.href. Actually what I get in the console is "Object tId=8 status=200 statusText=OK". Firebug also shows me that the browser does honor the redirect and actually downloads the file, but I get no "open/save" dialog.
What's the correct way of dealing with this situation? I really want my serverside code to remain the same for both Ajax and non-Ajax operation.