XMLHttpRequest mess with callbacks, handlers, etc.
The good news is that a very large number of AJAX interactions can be achieved much more simply by using the taconite plugin for jQuery. IMNSHO, this is a must-have plugin for jQuery. I believe there may also be taconite extensions for other JS frameworks.
Taconite basically creates a fire-and-forget environment. You send off your request to the server and then ... don't worry about it. Taconite intercepts the return package. It allows for multiple DOM changes in a single exchange, including
eval() of JS fragments.
Seriously, check this one out.