It may be relevant that the url I'm trying to redirect to is on a
different host (my openid provider.)  Could this be a single-origin
policy thing?

On May 4, 9:57 am, "phil.h.smith" <phil.h.sm...@gmail.com> wrote:
> Ah, bad paste with the form html.  There is in fact a <div id="quick-
> sign-in" style="display: none;" /> immediately wrapping it.
>
> On May 4, 9:52 am, "phil.h.smith" <phil.h.sm...@gmail.com> wrote:
>
> > This is my code, with a few alerts dropped in:
>
> > on('#quick-sign-in form', 'submit', function(event) {
> >   var form = event.element();
> >   event.stop();
> >   form.request({
> >     on302: function(response) {
> >       alert('Got 302.  headers: ' + response.getAllHeaders());
> >       var redirect = response.getHeader('Location');
> >       if (redirect != null) {
> >         window.location = redirect;
> >       } else {
> >         alert("There is no Location header.");
> >       }
> >     },
> >     onFailure: function(response) {
> >       $('quick-sign-in').shake();
> >     }
> >   });
>
> > });
>
> > The form:
>
> > <form action="/session" method="post"><div style="margin:0;padding:0">
> >   <input name="authenticity_token" type="hidden"
> > value="pzDitlV1b6zdnIzbcgvZkOdokxOFKwaSNafKT8NuPow=" /></div>
> >   <fieldset>
>
> >   <label for="openid_url">OpenID</label>
> >   <input id="quick-sign-in-textbox" name="openid_url" type="text"
> > value="" />
>
> >   </fieldset>
> > </form>
>
> > On submission, I see the two alerts ('Got 302' and 'There is no
> > Location header'.)  Additionally, the response.getAllHeaders() outputs
> > as an empty string.  This is in prototype 1.6.0.3, which comes canned
> > inside rails 2.3.2.
>
> > On May 4, 1:50 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
>
> > > Hi,
>
> > > XHR follows redirects automatically, are you _sure_ the response
> > > object you're getting back in your handler has a 302 status?  Or is
> > > that just what you're seeing in your sniff?  This code:
>
> > > * * * *
> > > new Ajax.Request("redirect.jsp", {
> > >     on302:  function(response) {
> > >         log("Got 302 response.");
> > >     },
> > >     onSuccess: function(response) {
> > >         log("Got success, code = " + response.status);
> > >         $('target').update(response.responseText);
> > >     },
> > >     onFailure: function(response) {
> > >         log("Got failure, code = " + response.status);
> > >     },
> > >     onComplete: function(response) {
> > >         log("Got completion, code = " + response.status);
> > >     }});
>
> > > * * * *
> > > (Also on Pastie:http://pastie.org/467401)
>
> > > ...works as expected:  The on302 never gets called, the onSuccess gets
> > > called with status 200 (and with correct content in
> > > response.responseText), as does the onComplete.  My redirect.jsp is
> > > issuing a redirect to a static HTML file, which is the content I see.
> > > In Firebug's Net tab, I see the 302 response followed by the GET of
> > > the static HTML file; it's the result of that second GET that I see at
> > > the XHR layer.
>
> > > If that doesn't explain what you're seeing, can you put together a
> > > minimalist, complete example of what you're doing and post it (perhaps
> > > to Pastie[1])?
>
> > > [1]http://pastie.org
>
> > > HTH,
> > > --
> > > T.J. Crowder
> > > tj / crowder software / com
> > > Independent Software Engineer, consulting services available
>
> > > On May 3, 9:18 pm, "phil.h.smith" <phil.h.sm...@gmail.com> wrote:
>
> > > > Hellos!
>
> > > > Does anyone know about any outstanding issues with retrieving response
> > > > headers from ajax requests?  I'm submitting a form by ajax & expect to
> > > > get a redirect on success.  I see the 302 status code indicating the
> > > > redirect, but in both camino (1.6.7) & firefox (3.0.10) prototype
> > > > can't access the Location header in the response.  In fact, it can't
> > > > access any headers.  And getAllHeaders() returns nothing.
>
> > > > I know it's not an issue with my server (http sniffing proved that
> > > > many headers, including Location, are in fact sent.)  Does anyone have
> > > > an idea why prototype wouldn't able to access these ajax response
> > > > headers?
>
> > > > Thanks!
> > > >   --phil--
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to