I'm not sure I understand. How can I use that variable and be assured
that (assuming you mean "sId" parameter) it writes back to the correct
DIV?

For example, on one particular page I call that function 3 times in
sequence:

updateCount('div_one');
updateCount('div_two');
updateCount('div_three');

Each time the function is called it's with a different ID, so when
"onComplete" fires, I need to know which particular ID is going to be
written to so that I can write "n/a" in the event that a numeric
string was not returned. If the 2nd call fails, for example, then how
do I know to write "n/a" to "div_two" and not "div_three"? I hope that
makes sense.

- Markus

On Nov 20, 9:49 am, Michael Peters <[EMAIL PROTECTED]> wrote:
> Michael Peters wrote:
> > Just use the variable. It's not stored anywhere in the object or it's 
> > prototype,
> > it's just automatically available to it's lexical scope. It's called a 
> > "closure"
> > (http://en.wikipedia.org/wiki/Closure_%28computer_science%29).
>
> I should clarify that for anyone else who's as pedantic as I am :)
> Javascript doesn't have real lexical scope and just has subroutine scope. So 
> the
> closure does exist but you can get unexpected (well unexpected if you're used 
> to
> real lexical scop) results if you try using a closure in a loop with the 
> looping
> variables.
>
> --
> Michael Peters
> Developer
> Plus Three, LP
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to