views:
1848answers:
3Short answer: You can't.
Question you really need to ask yourself is why would you want that over multiple XMLHTTPRequest objects ? There's hardly a downside to instantiating a dozen or so objects.
+1 to Martijn's answer, but I wanted to add that the enlightenment you're missing is that a Request is by definition a one time object.
You can reuse the object after the first request completes to issue a second request, and change onreadystatechange to a different function.
Not parallel, but very quick.
A note of caution, IE can't reuse XMLHTTPRequest objects, even in the native XMLHTTP implemented in IE7 and IE8.
For parallel requests, create multiple XMLHTTPRequest objects, and distribute your calls across them.
Another note of caution, when creating multiple objects in parallel, browsers may limit your usage of concurrent XMLHTTPRequest objects. Often in a very bad way by losing requests or transparently refusing to send them, so you'll want to test that carefully.
The safest way to do things is to create one request, use it, then dispose of it and create a new one. One at a time.