I got the following example in www.prototype.org. Can anyone tell me where/what is the value of "transport" pass from? new Ajax.Request(''/some_url'', { method:''get'', onSuccess: function(transport){ var response = transport.responseText || "no response text"; alert("Success! \n\n" + response); }, onFailure: function(){ alert(''Something went wrong...'') } }); --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2008-May-17 15:15 UTC
Re: what''s the transport in Ajax Request example?
Before 1.6, it was the XMLHttpRequest object. Since 1.6, it''s a Ajax.Response object. Check the docs on A.R callbacks (that didn''t update to Ajax.Response, though, and still state it''s a XHR object): http://prototypejs.org/api/ajax/options -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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, CP Thank you very much. Why can I use any argnames instead of "transport"? ex. new Ajax.Request(''/some_url'', { method:''get'', onSuccess: function(__ANYARGS__){ var response = __ANYARGS__.responseText || "no response text"; alert("Success! \n\n" + response); }, onFailure: function(){ alert(''Something went wrong...'') } }); where is __ANYARGS__ pass from ? On May 17, 11:15 pm, Christophe Porteneuve <t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> Before 1.6, it was the XMLHttpRequest object. Since 1.6, it''s a > Ajax.Response object. > > Check the docs on A.R callbacks (that didn''t update to Ajax.Response, > though, and still state it''s a XHR object): > > http://prototypejs.org/api/ajax/options > > -- > Christophe Porteneuve aka TDD > t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I am very sorry to ask so silly question. I am going to study the prototype.js then get back to myself..... but thanks the same. On May 17, 11:38 pm, wucho <UFORGOOD...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, CP > Thank you very much. Why can I use any argnames instead of > "transport"? ex. > > new Ajax.Request(''/some_url'', > { > method:''get'', > onSuccess: function(__ANYARGS__){ > var response = __ANYARGS__.responseText || "no response text"; > alert("Success! \n\n" + response); > }, > onFailure: function(){ alert(''Something went wrong...'') } > }); > > where is __ANYARGS__ pass from ? > > On May 17, 11:15 pm, Christophe Porteneuve <t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote: > > > Before 1.6, it was the XMLHttpRequest object. Since 1.6, it''s a > > Ajax.Response object. > > > Check the docs on A.R callbacks (that didn''t update to Ajax.Response, > > though, and still state it''s a XHR object): > > > http://prototypejs.org/api/ajax/options > > > -- > > Christophe Porteneuve aka TDD > > t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
2008/5/17 wucho <UFORGOOD.WC-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > Hi, CP > Thank you very much. Why can I use any argnames instead of > "transport"? ex. > > new Ajax.Request(''/some_url'', > { > method:''get'', > onSuccess: function(__ANYARGS__){ > var response = __ANYARGS__.responseText || "no response text"; > alert("Success! \n\n" + response); > }, > onFailure: function(){ alert(''Something went wrong...'') } > }); > > > where is __ANYARGS__ pass from ? >You can call it whatever you want. I use hungarian notation for my variables, so mine are o_Trans, o_JSON, etc. The param is supplied when the underlying ajax class calls the onXXXX method. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Christophe Porteneuve
2008-May-17 22:18 UTC
Re: what''s the transport in Ajax Request example?
wucho a écrit :> Hi, CP > Thank you very much. Why can I use any argnames instead of > "transport"? ex.Surprising question. Because, as with any language, the name you use for your arguments are irrelevant to the calling code. A function''s *signature* only cares about the number of parameters, and the types of these parameters. Arguments are like local variables, except that they''re initialized by the caller. So their names have no impact whatsoever on the calling code. Your callback is going to get passed the Ajax.Response object explicitly by Prototype''s Ajax.Request code. How your callback chose to name this argument is of no impact. -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---