Hello,
I'm not sure where the problem is...
I have an ajax request that checks the tracking information for a package on a page with a list of packages:
$(".fedex_status").each(function() {
var item = this;
// some code to construct tracking_url
$.ajax({
type: "GET",
url: tracking_url,
async: true,
cache: false,
success: function(data) { $(item).html("(" + data + ")"); },
error: function() { $(item).html("request failed...");}
});
});
So if there are 10 packages on the page (10 things with class 'fedex_status') 10 requests are created. The requests work fine, but results are returned one at a time (in a serial manner). I added a timestamp to the start and stop of a request within the controller action:
public ActionResult Fedex(string trackingNumber)
{
DateTime requestStart = DateTime.Now;
TrackingService tracking = new TrackingService();
string status = tracking.FedexTrackingNumberStatus(trackingNumber);
return Content(status + " - " + requestStart.ToString("hh:mm:ss.FFF") + " - " + DateTime.Now.ToString("hh:mm:ss.FFF"));
}
None of the timestamps overlap. So the controller is processing the requests one at a time. This seems crappy.
Now, the ajax request 'should' be parallel. It definitely returns immediately (its asynchronous). When I look at the IIS logs the requests have the same timestamp as the controller action return.
So my question is: is jquery not sending all the ajax requests in parallel or is IIS or ASP.NET only processing requests serially. I'm a big noob with IIS and the technical details of ASP.NET, so maybe its been misconfigured forever and only responds to one request at a time on everything (its internal use only, low traffic). That said, I'm also an idiot at jquery and not sure how to test when the requests are actually being fired (all I know is the $.ajax call returns immediately).
Thanks!