jQuery does send the header:
X-Requested-With: XMLHttpRequest

so you can check for that on the server-side.

On Jul 15, 11:47 am, candlerb <b.cand...@pobox.com> wrote:
> My complete() callback looks like this:
>
>       complete: function(res, status) {
>         if ( status == "success" || status == "notmodified" ) {
>           node.replaceWith(res.responseText);
>         }
>         else {
>           // Error handling here
>         }
>       }
>
> The login page gets inserted into the DOM, so I know the client must
> be chasing the redirect and I must be getting either "success" or
> "notmodified" in status. Looking at jQuery source, this comes from
> xhr.status (in function httpSuccess) which gives "success" for 2xx or
> 304, so any 3xx redirect code must have been followed and lost.
>
> I can check for xhr? at the server side, and if so, instead of
> redirecting to the login page I can send back some sort of uncommon
> HTTP error which can be detected, e.g. 410 Gone, or a custom HTTP
> header. I'll have a play along those lines.
>
> Cheers,
>
> Brian.

Reply via email to