[Project_owners] Callback functions
didier at ernotte.com
Tue Apr 5 07:16:54 EDT 2005
Personnaly, I hate global variable, this is againt my OO education...
I, instead, set all variables on the XMLHttpRequest object itself.
var request = new XMLHttpRequest();
request.myStatus = myStatus;
request.myValue = myValue;
and then, I retrive these value with request.myStatus in the
--- Stan James <sjames at uni-osnabrueck.de> wrote:
> Hi all,
> I have a question about callback functions, like onreadystatechange
> XMLHttpRequest(). What is the best way to pass state information to
> these functions? I find myself setting lots of global variables which
> are then read in by the callback function, because this seems to be
> only way to pass information it information. But this goes against
> my "good programming style" instincts. Plus, if I fire off 10
> XMLHttpRequests at once, it seems ridiculous to need 10 separate
> callback functions. Am I missing something obvious?
> I even toyed with creating the callback functions dynamically, but
> seems like a worse offense than using global variables!
> Thanks for any insight.
> Project_owners mailing list
> Project_owners at mozdev.org
More information about the Project_owners