aluminumpork
01-15-2006, 08:32 PM
Okay, this one is pretty specific to the XMLHttpRequest object. When setting up the object before you send, I do something like this:
function addDate(date){
createXMLHttpRequest();
xmlHttp.onreadystatechange = addDateStateChange;
xmlHttp.open("POST", "addDate.php?date=" + date);
xmlHttp.send(null);
}
So that's straight-forward and all. The part I'm wondering about is the "onreadystatechange". I set that the function I want to use when the XMLHttp state changes, but I how can I pass a variable to it that is not global? I can't put "addDateStateChange(date);" on the end of it, that's no good. Right now I have to just var out a bunch a globals and use those, and I feel dirty for it :-D. Any ideas?
Thanks
function addDate(date){
createXMLHttpRequest();
xmlHttp.onreadystatechange = addDateStateChange;
xmlHttp.open("POST", "addDate.php?date=" + date);
xmlHttp.send(null);
}
So that's straight-forward and all. The part I'm wondering about is the "onreadystatechange". I set that the function I want to use when the XMLHttp state changes, but I how can I pass a variable to it that is not global? I can't put "addDateStateChange(date);" on the end of it, that's no good. Right now I have to just var out a bunch a globals and use those, and I feel dirty for it :-D. Any ideas?
Thanks