ui autocomplete should wait untill ajax call is fired.
Hi there,
I need autocomplete similar to the momondo.com. i am new in jquery world, Though i have implemented the basic control using asp.net httpmodule. but i need more control on the field. For example, if user type in the autocomplete quickly and tab to other field , no result is returned, how would i handle this? any suggestions??
- $(function() {
var local = {};
$("#birds").autocomplete({
minLength: 3,
highlight: true,
delay: 200,
source: function(request, response) {
$.ajax({
url: "SearchLocations.aspx",
data: "term=" + request.term,
dataType: "json",
type: "Get",
contentType: "application/jsonp; charset=utf-8",
success: function(data) {
response(data);
},
complete: function(jqXHR, textStatus) {
local = jQuery.parseJSON(jqXHR.responseText);
$("#birds").val(local[0].value) ; select first one if user tab in the field before ajax call complete
}
});
}
});
});