I want to replace the contents of a div with the response from Form.request. According to the prototype api I can use a callback function to do so: $(''person-example'').request({ onComplete: function(){ alert(''Form data saved!'') } }) My only confusion, is where is the response? I can see it in firebug, but have no clue how to access it! I would like something like: $(''person-example'').request({ onComplete: function(){ $(''div'').innerHTHML = response; } }) --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 5, 2008 11:30 AM, jonathon <jon23d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> My only confusion, is where is the response? I can see it in firebug, > but have no clue how to access it! I would like something like: > > > $(''person-example'').request({ > onComplete: function(){ $(''div'').innerHTHML = response; } > })It is right there, you just forgot to pass the argument. onComplete: function(request){ $(''div'').innerHTHML request.transport.responseText; Might want to look into using the Ajax.Updater instead, as it takes care of this extra work for you. -justin --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
What do you mean about using Ajax.Updater? I have forms that are filled out, and then the response is passed back in the request object. On Feb 5, 9:40 am, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Feb 5, 2008 11:30 AM, jonathon <jon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > My only confusion, is where is the response? I can see it in firebug, > > but have no clue how to access it! I would like something like: > > > $(''person-example'').request({ > > onComplete: function(){ $(''div'').innerHTHML = response; } > > }) > > It is right there, you just forgot to pass the argument. > > onComplete: function(request){ $(''div'').innerHTHML > request.transport.responseText; > > Might want to look into using the Ajax.Updater instead, as it takes > care of this extra work for you. > > -justin--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---