i’m trying to load the autocomplete data at the page load, right now it is doing the getJson when i type some letters in the input, and because of the size of the json data, it is freezing. So i want the autocomplete json request to be fired at the loading of the page, and have the data, so when i start typing it wont freeze. Cheers!
<script>
$(function() {
$.getJSON("airports.php", function(data) {
$( "#cityAirport" ).autocomplete({
source: data
});
});
});
</script>
My Exatc problem is, that right now when i start typing something, the website freezes for a seconds (2-3) when getJson is fired…
I’ll make an answer out of this instead of a comment. You can limit it and also use
minLengthto only get the data when you have typed more than * characters.If this doesn’t fix it, maybe try fetching less results in the first place.