I believe you need some sort of closure. Try using curry. Here's an
untested piece of code that might do what you need:
onSuccess: (function(datum, transport) {
// your code
}).curry(datum);
[EMAIL PROTECTED] wrote:
> Hello,
>
> i try this
>
> getDaySum: function()
> {
> var elements = $$('[id^="daysum["]');
> var vars = "";
> var datum = "";
> for (i = 0; i < elements.length; i++)
> {
> datum = elements[i].id.substring(7,17);
> vars = '&datum=' + datum;
>
> new
> Ajax.Request('index.php?m=arbeitszeiten&c=getTagessumme'+vars,
> {
> evalScripts:true,
> onSuccess: function(transport)
> {
> var response = transport.responseText;
> $('daysum['+datum+']').innerHTML =
> response;
> //alert("Success! \n\n" + response);
> } ,
> onFailure: function(){ alert('Die Verbindung
> zum Server ist
> unterbrochen!') }
> });
> }
>
> },
>
>
> the problem is, when get the onsuccess the "datum" var is on the last
> iteration value. how can i give the onsuccess the "datum"
>
> ____________
> Virus checked by G DATA AntiVirusKit
> Version: AVK 18.497 from 10.11.2007
> Virus news: www.antiviruslab.com
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---