One problem I can spot is in this line:
The intention is to set a callback function to be called asynchronously by browser.
But due to the parentheses, what this actually does is make a function call immediately to gotInventoryCallback()
(which is why you don't see the alert in that function), and then assign its return value (null value) to req.onreadystatechange, which is meaningless.
The correct code should be
This is the one I could spot, but I didn't go through your XML implementation in detail. Try out this correction and if there are further problems, ask away on this
thread.
Also, IMO,
you should stop using the raw XMLHttpRequest API and start with jquery (it's not the only one out there, but it's good to start with). It helps write much more compact, readable, cross-browser error free code.
In jquery, this would have been