Ajax, XML and 301/302 responses

Ajax, XML and 301/302 responses

Hi,

I'm having a problem to follow redirects on 301/302 when the type is "xml". From what I've understood, the browser doesn't follow redirects (at least Firefox 3.6), and jQuery's ajax function doesn't follow them either.

So I have to do it myself, and I'm trying to do so by using adding a complete() method to the options of my Ajax query.

The problem is that in the case of a 301/302, the response is empty. That causes an error (parseerror) because empty is not valid XML, and instead of getting my 301/302 status with the Location header to know what to follow, I get a status 0 and no Location header.

So, how can I follow the redirect for XML requests? Would it make sense to add a flag in jQuery.ajax like "followRedirect"?