Ajax.Request objects are not designed to be reused, so creating a new one in the callback function every time it's needed is no problem. As a local variable (or not even a variable!), it will get garbage-collected properly.Something like: var flashState1 = 'blah'; var flashState2 = 42; new Form.Element.Observer('myFormElementID', 500, function(elt, value) { new Ajax.Request('/your/server/script', { // whatever other options you use, e.g. method, onSuccess... parameters: { value: value, fs1: flashState1, fs2: flashState2 } }); });And there you go! Since the callback's body is evaluated every time the observer detects a change, it will take the latest values for your global variables. BTW, this is based on 1.5 RC2.
Wow. I'm sorry, I didn't even see how good this was. This would have been a much nicer solution. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
