Matt Foster wrote:
[...]
> 
> To address the "wrong order" issue, you could create a queue of
> requests such that each request is asynchronous but stacked such that
> it will not be sent until the previous request has returned.  I've
> written something for this for prototype 1.5 as Ajax.RequestQueue and
> formalized this idea in my AgileAjax package in the class AjaxService.
> 

I think this is not a good idea for autocompleter purposes. 
Autocompleter needs to be very fast. If you wait with next request 
until previous was completed, and, say, that previous request was 
dropped somewhere in the net, then you will wait long time, a few 
seconds at least until it will time out.

The better approach is to identify each request with some unique id, 
maybe a serial number, and check if the response you just received is 
the response for the last sent request. If the responses are 
deterministic, then parameters of request are sufficient id, if not, 
then you need a unique identifier.

I personally use Ajax.Request for this purpose. I add a serial number 
to parameters, and, at server side, I put the serial number to the 
X-JSON: header, along with status (such as error codes, if any, or 
success indicator etc). Then in the onComplete I check the header 
only. But this is only possible if you have control over serverside 
script.

I haven't any need to access the request object from the response one, 
but I always thought it was available as a parameter of the 
Ajax.Response object [1].

Richard,
As for the bug, maybe it's worth submitting the patch again to the 
Lighthouse [2], as the Trac is used no more.



1. http://prototypejs.org/api/ajax/response
2. http://prototype.lighthouseapp.com/


Best Regards,
SWilk

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to