[thelist] AJAX: Generlizating Response Handling, RFC

Sam Foster sam at sam-i-am.com
Mon May 16 21:59:26 CDT 2005


>...
>  
>
>>Interesting solution. My aim is to avoid creating an instance of
>>XMLHttpRequest for every request, though. Of course, one might argue
>>that if I am creating a new request, then I should be creating a new
>>request object.
>>    
>>
>
>Actually, the more I think about t his, the less comfortable I am with
>re-using XMLHttpRequest objects. Indeed, someone I've talked to said
>it does not work well across browsers, but even if it did it simply
>seems wrong.
>  
>
I tried the page you put up in windows IE6, and it seems to stop working 
after the first "available" confirmation. I never get the "unavailable" 
msg that I see in Firefox.

It would be useful to do some tests and see how much time is spent 
instantiating the new objects- see if there's even an appreciable 
problem that needs solving through reuse. As far as the principle goes, 
I can see it both ways. Certainly my first instinct was to create the 
object just once, and use it repeatedly. But as I struggled with getting 
that to work, I convinced myself that a request is consumed in the 
requesting, and it makes sense to make a new request every time. I 
couldn't say with certainty that reuse can't be done, but the 1:1 model 
is a lot easier to work with.

Sam



More information about the thelist mailing list