Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xmlhttp problem sending multiple queries?

Status
Not open for further replies.

esdee

Programmer
Apr 12, 2001
143
US
im using code like this:
Code:
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
 }

  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
            // -- use response
      }
    }
    
    x.open("GET", url, true);
    x.send(null);

but when i use it to send multiple requests i dont have real multiprocessing: the webserver doesnt serve the result from one query before it has finished sending the result from the previous! is this what i should expect or can i trick it so i have for example 4 threads receiving the results of 4 queries?

------------------------
 
That was my first mistake too [smile]. These requests are synchronous.

In a recent solution, I waited until each response handler had fired before sending off another request.

You are right in thinking that you can instantiate more xmlhttp objects (one thread per object) to achieve an "asynchronous" effect, too.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
but i am creating the xmlhttp in a function, so when i call the function several times a separate object is created each time isnt it ?
i can see that each call is sent immediately, the problem is with the response - the server doesnt send me a response per request until the previous request has been handled.
im implementing this with asp.net so when im debugging i see that the asp.net page i open is fully processed and just then the next page from the async call is processed.
could it be IIS problem?

------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top