Yes, thats exactly what i needed apparently ;-)

I had tried to do it as you speced out below, but i got an undefined 
object js error so i had assumed due to scoping issues i couldn't quite 
do it like this.
The other response to my post from Michael Peters (which had me to a 
closure in the actual function invoked by onComplete) seems to work.

I tried it again your way (because this seems a little more intuitive to 
me) but still recieved a js error so i'm not quite sure ...

Thanks though.

Gregory Hill wrote:
> You need a closure.
> 
> onComplete: function (response) { NamedActionResponseHandler(theElement,
> response); }
> 
> Is that what you mean?
> 
> Greg
> 
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
> [mailto:rails-spinoffs-
>> Ajax.Request ?
>> 
>> My basic setup is i have an html element triggering an event (the ajax
>> update).
>> I have additional information encoded into the element about how it
>> should handle different response codes returned from the ajax event.
>> The problem is, i havn't figured out a way to specify the id of my
>> element to be passed along to the onComplete function, so right now i
>> just stick it in a global js variable before the ajax call and then
> look
>> it up in my on Complete function, but thats pretty hacky.
>> 
>> I suppose i can pass the elementId as a param to my ajax call, and
> have
>> 
>> function NamedActionHandler(theElement)
>> {
>>      //set our global reference to the element so we can access it in
>> later
>> functions
>>      //since ajax calls take us to other functions and we can't seem
> to


-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to