Displaying 3 results from an estimated 3 matches for "namedactionresponsehandler".
2006 Apr 10
10
Prototype Ajax - How to pass my own params to onComplete ?
...calls take us to other functions and we can''t seem to pass
it along
NamedActionElement = theElement;
//skip setting up my vars for the ajax call
//make the ajax call
var ajaxCall = new Ajax.Request( urlCall,
{method: ''post'',
postBody: postFormData,
onComplete: NamedActionResponseHandler}
);
}
function NamedActionResponseHandler(theResponse)
{
var elementThatTriggeredEvent = NamedActionElement;
//do stuff based on values i have encoded into the element and
//the data returned in theResponse
}
----------------------
As you can see, i have to have this global variable so my onC...
2006 Apr 10
1
RE: Re: Prototype Ajax - How to pass my own params toonComplete
...ly). You can do
.bindAsEventListener to make sure the event object is passed along, in
the case of real event handlers, but that doesn''t apply here.
I''m not sure why my suggestion earlier didn''t work. You should be able
to do this:
onComplete: function (theResponse) {
NamedActionResponseHandler(theResponse, theElement); }
function NamedActionResponseHandler (theResponse, theElement) {
// work your magic
}
If you are sending your ajax call inside another object and need to make
sure the response function is called on the same object, that is where
the .bind() would be useful.
Greg
>...
2006 Apr 10
1
RE: Prototype Ajax - How to pass my own params toonComplete ?
You need a closure.
onComplete: function (response) { NamedActionResponseHandler(theElement,
response); }
Is that what you mean?
Greg
> -----Original Message-----
> From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-spinoffs-
> bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Erin Brewer
> Sent: Mon...