XMLHttpRequest isn't really reusable. In this case, what you'd
want to do is something like this:
var req;
function buildRequest(url,xml) {
req = new XMLHttpRequest()
req.onreadystatechange = process;
req.open("POST", url, true);
req.send(xml);
}
This way, a new XMLHttpRequest object is created, but the reference
(req) is maintained outside the function so that your handler can
support it. Each time you want to call the request, simply call
the buildRequest method with the url & the xml you need.
Niels
On Nov 12, 2006, at 8:55 AM, David Allen wrote:
I have a program that requires multiple XMLHTTPRequests. I use the
following code in a loop:
var req = new XMLHttpRequest();
req.onreadystatechange = process;
req.open("POST", "http://url.com:port/page.cgi", true);
req.send("Lots and lots of XML")
When I run it the first time, everything goes smoothly, but when I
run
it the second time, req.open fails to work - i.e. req.readyState
stays
0 afterwards.
Any ideas?
Thanks,
David.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/web-dev/email@hidden
This email sent to email@hidden