Something like this...
 var myAjax = new Ajax.Request( url, {method: 'get', parameters:
parms, onComplete: processRSS.curry(foo)} );

I used to do this all the time in my classes with Function#bind but
since 1.6 they have introduced curry(We cooking rice?) which is a slim
downed version of bind specifically targeted to your use case. enjoy!
As a side note, things may not be as you first expect, the curried
parameter is going to come through first you'll be looking at a
signature more like this...
function processRSS(foo, xmlHttpRequest, responseHeader ) {

Techy demo, gotta look at the source and firebug console to see whats
happenin, http://positionabsolute.net/projects/javascript/CurryTest/

--
Matt Foster
Ajax Engineer
Nth Penguin, LLC
http://www.nthpenguin.com


On Jun 26, 2:02 pm, ljundie <[EMAIL PROTECTED]> wrote:
> hi all,
>
> i'd like to know if there's a way to send parameters to a callback in
> Prototype. For example, i have a code like:
>
>  function getRSS() {
>          var url = "feed.xhtml";
>          var myAjax = new Ajax.Request( url, {method: 'get', parameters:
> parms, onComplete: processRSS} );
>          }
>
>  function processRSS(xmlHttpRequest, responseHeader) {
>
>          var xmlString = xmlHttpRequest.responseText;
>
>          alert (xmlString);
>
>  }
>
> would be possible to give more parameters to processRSS() and do
> something like...
>
>  function processRSS(xmlHttpRequest, responseHeader, foo) {
>
>          var xmlString = xmlHttpRequest.responseText;
>
>          if (foo){
>                  alert (xmlString);
>                  }
>  }
>
> thanks in advance for your help,
> Luis
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to