This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes [AJAX] Making the jump from global scope to local scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "[AJAX] Making the jump from global scope to local scope" Watch "[AJAX] Making the jump from global scope to local scope" New topic
Author

[AJAX] Making the jump from global scope to local scope

Barend Garvelink
Ranch Hand

Joined: Dec 07, 2004
Posts: 64
Hi Ryan and Nathanial,



I recently wrote a client-side treeview control using AJAX technology, firing XmlHttpRequest whenever a node was doubleclicked to fetch its contents. The system was set-up as a client-side object graph, that recursively writes itself into the HTML DOM whenever something changed. The Javascript object graph was king; you could say that the DOM was "slaved" to its state changes (albeit via a push mechanism).

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?


SCJP 1.4, SCJD 1.4, SCWCD 1.3, ICSD:Websphere 5.1
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [AJAX] Making the jump from global scope to local scope
 
Similar Threads
Hidden Frames
How to send the user back to a field on a long form
what will be next after AJAX ?
Displaying DOM using swing
Page section does not update after call of a4j:support in IE 9