To begin with, I believe that inside of a prototype ajax request I can
use a statement like this:
onSuccess:function(transport){ put_my_own_function_here }
Also, as I understand it, I should be able to pass transport into my
own function and retain its data, like this:
onSuccess:function(transport){ myOwnCleverFunction(transport) }
1) Am I misunderstanding prototype? if so, then how?
2) If I am not misunderstanding, then why is my data gone when I try
to access transport in my own function?
I would rather just load my data from the ajax call into the
''request''
var that I am creating at the start and _get out_ of
prototype''s scoping problem.
In this snippet:
var request = new Ajax.Request(''imagefetch.php'',
<---------------------------------I want my request loaded with data!!
{
method:''get'',
onSuccess: function(){
var content = transport.responseText.evalJSON();
},
onFailure: errorOccured
});
Please can anyone offer up some direction on how prototype handles
this problem?
Thanks in advance
Dane
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Actually, the wiki is pretty straight forward
http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request
the below is edited based on my own experience just today - the form
serializer is there just for show, also note that you don''t have to
actually
pass the transport to the defined functions
var handlerFunc = function(t) {
alert(t.responseText);
}
var errFunc = function(t) {
alert(''Error '' + t.status + '' -- '' +
t.statusText);
}
new Ajax.Request(''/foo/bar'',
{parameters:Form.serialize(''form_id''+''&hardcodedvar=something&thisvar=true&thatvar=Howdy'',
onSuccess:handlerFunc, onFailure:errFunc});
On 9/3/07, deepsnow <daneensign-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
>
> To begin with, I believe that inside of a prototype ajax request I can
> use a statement like this:
>
> onSuccess:function(transport){ put_my_own_function_here }
>
> Also, as I understand it, I should be able to pass transport into my
> own function and retain its data, like this:
>
> onSuccess:function(transport){ myOwnCleverFunction(transport) }
>
> 1) Am I misunderstanding prototype? if so, then how?
> 2) If I am not misunderstanding, then why is my data gone when I try
> to access transport in my own function?
>
> I would rather just load my data from the ajax call into the
''request''
> var that I am creating at the start and _get out_ of
> prototype''s scoping problem.
>
> In this snippet:
> var request = new Ajax.Request(''imagefetch.php'',
> <---------------------------------I want my request loaded with data!!
> {
> method:''get'',
> onSuccess: function(){
> var content = transport.responseText.evalJSON();
> },
> onFailure: errorOccured
> });
>
> Please can anyone offer up some direction on how prototype handles
> this problem?
>
> Thanks in advance
>
> Dane
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Brian, Thanks for the response! Im off and running. Dane On Sep 3, 1:40 pm, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Actually, the wiki is pretty straight forwardhttp://wiki.script.aculo.us/scriptaculous/show/Ajax.Request > > the below is edited based on my own experience just today - the form > serializer is there just for show, also note that you don''t have to actually > pass the transport to the defined functions > > var handlerFunc = function(t) { > alert(t.responseText); > > } > > var errFunc = function(t) { > alert(''Error '' + t.status + '' -- '' + t.statusText); > > } > > new Ajax.Request(''/foo/bar'', > {parameters:Form.serialize(''form_id''+''&hardcodedvar=something&thisvar=true&thatvar=Howdy'', > onSuccess:handlerFunc, onFailure:errFunc}); > > On 9/3/07, deepsnow <daneens...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > To begin with, I believe that inside of a prototype ajax request I can > > use a statement like this: > > > onSuccess:function(transport){ put_my_own_function_here } > > > Also, as I understand it, I should be able to pass transport into my > > own function and retain its data, like this: > > > onSuccess:function(transport){ myOwnCleverFunction(transport) } > > > 1) Am I misunderstanding prototype? if so, then how? > > 2) If I am not misunderstanding, then why is my data gone when I try > > to access transport in my own function? > > > I would rather just load my data from the ajax call into the ''request'' > > var that I am creating at the start and _get out_ of > > prototype''s scoping problem. > > > In this snippet: > > var request = new Ajax.Request(''imagefetch.php'', > > <---------------------------------I want my request loaded with data!! > > { > > method:''get'', > > onSuccess: function(){ > > var content = transport.responseText.evalJSON(); > > }, > > onFailure: errorOccured > > }); > > > Please can anyone offer up some direction on how prototype handles > > this problem? > > > Thanks in advance > > > Dane--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---