[AJAX] Making the jump from global scope to local scope
posted 10 years ago
Hi Ryan and Nathanial,
One of the harder nuts to crack was how to make the jump from the onreadystatechange method back into my object-oriented scope. I tackled it using the Function() constructor to hard-code the path to my node into each event handler. The root node rested in global-scope, and a recursive lookup function did the rest. This way, I was able to keep track of multiple XmlHttpRequests at once, but it never did feel like a pretty solution. I ended up with multiple (okay, two) hashtable objects in the global scope just to tie up all my event handlers.
I wonder if your book addresses the issues that come with firing multiple XmlHttpRequests at once, and with connecting what's essentially a Visual Basic control to an object-oriented world. Did I overlook something blindingly obvious?