Monday, March 26, 2012

Multiple XmlHttpRequest

Hi All,

I am new in Ajax Web Technologies. But want to learn deeply. Currently I am trying to develop a web application which reports ISA Server logs according to our needs.For example, I am fetching a dataset from SQL server and displaying them on a table. As soon as page loaded, I am executing Ajax functions which resolve host name from IP address. As you can imagine the result of query is more than 300 rows. So, resolving IP addresses one by one for 300 rows takes too long time and it is not desirable. In order to handle this problem I used Ajax library that I found onhttp://www.szajkowski.com/ajaxsample.html . It is pretty good. It creates multiple xmlhttprequests at same time. And its object handles are being stored separately. So no overwritten requests.

But the problem is, because of the limitations of IE and even Firefox, only two XmlHttpRequests are permitted for requests which points to same domain. As I learnt, it was possible to increase this value by modifying registry settings. But I don't want to do it.

I wondering that is it possible to make many simultaneous Ajax requests by using Web service methods? In XmlHttpRequest If I use POST in stead of GET.

Or is there any other way to be able to accomplish it?

Thanks in advance for your helps.

As far as I know, unless you're using some kind of IFrame-based hack, all the methods you describe are still using XmlHttpRequest objects 'under the hood'.

However, I'd argue that 2 is enough at any given time. Consider paging and chaining calls. For example, let's say that you want 50 items per page. You fire off two ajax calls, and those calls return with the 50 records plus information about which page they are and what the total number of pages is. Your 'OnRequestSuccess' handler on the clientside inspects that information in additon to parsing the data into your page, it decides if there's more data to be gotten, and fires off a request for the next page. You'd probably want to add in some logic to make sure you're not grabbing the same page twice and the like as well, but that's the basic idea. Figure that it'll take the user at least a few seconds to look at each page of data, and even if that's not quite enough time for the next batch to come down, you should be at least one page ahead of him at all times.

paul


Hi Paul,

You are right. I did some modification on server-side code.Now, I am using just one XmlHttpRequest and sending all IPs at once. And in server-side code, I used multi threaded DNS queries. And after all threads exits, it sends the all results together at once.

Thank you very much for your interest and valuable comments.

Ilhan

No comments:

Post a Comment