What I'm saying is the browser performs the redirect automatically--
so your AJAX object won't see the 302 (et al) header in its status.
It will see whatever status code from the page it redirected to--in
your case, probably 200.
Yes, it will get whatever response the redirect target provides
(login, in this case), but you have no programatic way (to my
knowledge) of determining a redirect occurred without parsing the
result for values you know your application should return.
And as to your question in your other email: Force a page refresh/
redirect by changing document.location.href. It's standard
Javascript; search Google for some good examples.
To modify the example from the Prototype docs:
new Ajax.Updater('items', '/items', {
parameters: { text: $F('text') },
insertion: Insertion.Bottom,
on403: function (transport) { // <== new handler
// Authentication timeout; redirect
document.location.href = newUrl;
}
});
TAG
On Apr 11, 2007, at 1:24 AM, grigora wrote:
>
> On Apr 10, 7:48 am, Tom Gregory <[EMAIL PROTECTED]> wrote:
>> That's mostly true. Redirect headers (e.g., 301, 302), are handled
>> transparently by the browser, so your Javascript will never see 'em.
>>
>> TAG
>
> Thanks for all the comments. My handler (modperl) returns a redirect
> header with HTTP 302. However, unlike how you describe it, the login
> page actually appears in the <div> where the response text should
> ideally appear when the credentials are still valid, which leads me to
> think that JavaScript (and not the browser) still has control of
> what's returned.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---