Ravenn
09-20-2005, 06:52 PM
I have a page that uses XmlHttpRequest to populate a dynamic tree. When the tree is opened with initial directory as a parameter, it's sorta calling itself to open itself down to that folder.
I don't have the code but I'll outline it; it's nothing special.
I have a logging facility and I will post the long to explain the error. And yes the response handler checks for the stare being 4 and for status 200 too.
So it's like that; XmlHttp is in one global variable.
CallHttpRequest(Folder)
{
log(call,Folder); asynchandler = function() { Handler(Folder) }; send(url?f=Forder);
}
Handler(Folder)
{
if (check stuff) { log(hndstart,Folder); MainFunction(Folder); log(hndend,Folder);
}
MainFunction(Folder)
{
...do stuff; CallHttpRequest(AnotherFolder);
//so, the next request is sent in the handler of the previous one
}
Here's the log I always get
sending request for TreeLoader.aspx
handler fired null
sending request for TreeLoader.aspx?Folder=1
handler ended null
handler fired 1
sending request for TreeLoader.aspx?Folder=1\2
handler ended 1
handler fired 1\2
handler ended 1\2
handler fired 1\2
handler ended 1\2
Why doesthe response for 1\2 tirgger handler two times? I only send one request!
I don't have the code but I'll outline it; it's nothing special.
I have a logging facility and I will post the long to explain the error. And yes the response handler checks for the stare being 4 and for status 200 too.
So it's like that; XmlHttp is in one global variable.
CallHttpRequest(Folder)
{
log(call,Folder); asynchandler = function() { Handler(Folder) }; send(url?f=Forder);
}
Handler(Folder)
{
if (check stuff) { log(hndstart,Folder); MainFunction(Folder); log(hndend,Folder);
}
MainFunction(Folder)
{
...do stuff; CallHttpRequest(AnotherFolder);
//so, the next request is sent in the handler of the previous one
}
Here's the log I always get
sending request for TreeLoader.aspx
handler fired null
sending request for TreeLoader.aspx?Folder=1
handler ended null
handler fired 1
sending request for TreeLoader.aspx?Folder=1\2
handler ended 1
handler fired 1\2
handler ended 1\2
handler fired 1\2
handler ended 1\2
Why doesthe response for 1\2 tirgger handler two times? I only send one request!