I'm working with v4.0.13 of Select2 library and using AJAX as the data source. I keep encountering an 'abort' error in response.statusText whenever I type at a faster speed in the dropdown's search field. Besides the error encounter, the plugin does work correctly.
I tried removing the delay option but that didn't help. A user on SO also mentioned this issue as part of another question, but I thought I'd create a new question for it specifically.
What is the reason for this issue, and how can I fix it? It appears to be a client-side issue. I am not getting errors on the server.
My code:
<script>
$('.js-data-example-ajax').select2({
ajax: {
url: function (parameters) {
return 'clients?handler=Clients&searchValue=' + parameters.term;
},
dataType: 'json',
delay: 350,
error: function (response) {
console.error(response);
}
},
minimumInputLength: 2,
dropdownAutoWidth: true
});
</script>
<select class="js-data-example-ajax"></select>