Ok, i tried this technique again and got it to work, not sure what i did 
different this time (i think i was calling 'theResponse' just 'response' 
when i first tried it, but not sure why that would matter).

In any event, its really nice to understand the multiple ways to 
accomplish this, thanks.

Now if i can just get that .bind method to work as well ... ;-)

-Erin

Gregory Hill wrote:
> That technique will not work for this case.
> 
> By default, the response element is passed in to the onComplete handler
> as the first argument.  Basically, all 'bind' does it let you bind the
> 'this' element to the function, so when you reference this.whatever in
> the function, the 'this' refers to 'this' in the scope that the event
> handler was defined.  Calling bind with additional parameters does not
> work as far as I know (unless something changed recently).  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
> 
> 
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
> [mailto:rails-spinoffs-
>> [EMAIL PROTECTED] On Behalf Of Erin Brewer
>> Sent: Monday, April 10, 2006 3:10 PM
>> To: rails-spinoffs@lists.rubyonrails.org
>> Subject: [Rails-spinoffs] Re: Prototype Ajax - How to pass my own
> params
>> 
>> In the function I get 'theResponse' as the returned xml still, but
>> 'theElement' is undefined, am i missing something?
>> 
>> 
>> Martin Bialasinski wrote:
>> > On 4/10/06, Michael Peters <[EMAIL PROTECTED]> wrote:
>> >> change this function to return another function. Something like
> this:


-- 
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