I am trying to get the data and auto-populate dropdown from the data in DB. For this i am doing an ajax call with every character added.
So as user types, with every character typed , ajax calls goes to the server and returns results.
Now there is lot of data on server side and while getting back browser hangs .
what can i do to curb it.
var Url = '/abc/def/ghi';
$("#id").select2({
placeholder: "Select the Broker",
minimumInputLength: 1,
ajax: {
url: Url,
dataType: 'json',
data: function (term, page) {
return {
term: term, // search term
page_limit: 10,
};
},
results: function (data, page) {
return {results: data};
},
allowClear: false
}
});
Is there any possible way i can make ajax calls in a better way.