When using Yahoo Autocomplete with a remote php database request and zero time delay, I sometimes encounter the issue of old query results coming back after the most recent query. For example, if I search for "beginner", the results from "beg" may override the most recent result in the autocomplete dropdown if that query takes longer to return from the server.
I have attempted aborting old queries, but this slows down the user experience as they do not receive a server response until the last keystroke. Is there a way to order the queries that return to ensure that the server response from the most recent query displays?
Thank you in advance, David
Can anyone provide assistance on sequencing? My current Yahoo autocomplete code is as follows, and I am looking to avoid cancelling stale requests:
<script type="text/javascript">
YAHOO.example.autocomplete = function() {
// instantiate remote data source
var oDS = new YAHOO.util.XHRDataSource("../employer/post-job/get_towns.php");
oDS.responseType = YAHOO.util.XHRDataSource.TYPE_XML;
oDS.responseSchema = {
resultNode: 't',
fields: ['n']
};
oDS.maxCacheEntries = 100;
// oDS.queryMatchSubset = true;
// oDS.connXhrMode = "cancelStaleRequests";
// instantiate YUI autocomplete widgets
var oAC0 = new YAHOO.widget.AutoComplete("input1", "inputcontainer", oDS);
oAC0.minQueryLength = 3;
oAC0.queryDelay = 0.05;
oAC0.maxResultsDisplayed = 10;
return {
oDS: oDS,
oAC0: oAC0
};
}();
</script>