I am using the jquery autocomplete to fill the users list.
In the document.ready
, i am calling the autocomplete json to get the users list.
When i type a valid username(or anything) in the textboxes before the autocomplete json call finishes, its not showing the autocomplete options(autocomplete not working for valid characters also).
And when i click outside the textbox and on again trying, its working..
What may be the problem with the autocomplete when i try to type before the autocomplete json call finishes?
The code for autocomplete is:
$.getJSON("/User/GetAllUsers/?t=" + new Date(), {},
function(data) {
if (data != null) {
$("#UserName").autocomplete(data, { mustMatch: false, matchContains: 4, max: 50,
formatItem: function(row) {
return row.FirstName + " " + row.LastName + " [" + row.LoginName + "]";
},
formatResult: function(row) {
return row.FirstName + " " + row.LastName + " [" + row.LoginName + "]";
}
});
}
});