Hi i''m using prototype for a project but i have some questions i can''t find in the api docs. 1) if you make an ajax request, you get in the oncomplete function the response with transport.responseText ... Now i would like to know what other methods and vars there are in the transport object... Or can you only use .responseText?? 2) i would like to make a response formatted in JSON instead of plain html, but i don''t know how the request.php page must output the data then and i neighter know how i can get the response in JS as an object. (you understand me?) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
there is responseJSON as well, set your http header content type to application/json and return the json string in the body of the request. If you screw it up it will be undefined. You should also use onSuccess instead of onComplete and you can check all the standard xmlhttprequest response object properties such as status and statusCode. http://www.prototypejs.org/api/ajax/request Gareth On 11/30/07, hipska <hipska-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hi i''m using prototype for a project but i have some questions i can''t > find in the api docs. > > 1) if you make an ajax request, you get in the oncomplete function the > response with transport.responseText ... > Now i would like to know what other methods and vars there are in the > transport object... > > Or can you only use .responseText?? > > > 2) i would like to make a response formatted in JSON instead of plain > html, but i don''t know how the request.php page must output the data > then and i neighter know how i can get the response in JS as an > object. (you understand me?) > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks for your reply, but it seems that this isn''t working, or i''m doing something wrong. Do you have a little example for me? On 30 nov, 10:19, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> there is responseJSON as well, set your http header content type to > application/json and return the json string in the body of the request. > If you screw it up it will be undefined. > You should also use onSuccess instead of onComplete and you can check all > the standard xmlhttprequest response object properties such as status and > statusCode.http://www.prototypejs.org/api/ajax/request > > Gareth >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi hipska, I was doing something a few weeks ago that required something other than responseText, and the easiest thing for me was to just look through the prototype.js file to see what is available. Now, don''t take that to mean I believe it''s *easy* for just anyone to look at that code and have it make sense. I''m not a javascript guru by any stretch of even the most wild imagination, but after a little study, it does start to make a little sense. Enough to figure out what you need to anyway. Good luck! Phillip On Nov 30, 2007, at 4:18 AM, hipska wrote:> > Thanks for your reply, but it seems that this isn''t working, or i''m > doing something wrong. > > Do you have a little example for me? > > On 30 nov, 10:19, "Gareth Evans" <agr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> there is responseJSON as well, set your http header content type to >> application/json and return the json string in the body of the >> request. >> If you screw it up it will be undefined. >> You should also use onSuccess instead of onComplete and you can >> check all >> the standard xmlhttprequest response object properties such as >> status and >> statusCode.http://www.prototypejs.org/api/ajax/request >> >> Gareth >> > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---