Introducing delay while ajax call in select2 plugin

The answer to your question is in the actual example you've pointed us to:

ajax: {
    url: "http://api.rottentomatoes.com/api/public/v1.0/movies.json",
    dataType: 'jsonp',
    quietMillis: 100, // <----------- HERE change it to 1000
    data: function (term, page) {
        return {
            q: term, //search term
            page_limit: 10,
            page: page,
            apikey: "ju6z9mjyajq2djue3gbvv26"
        };
    },
    results: function (data, page) {
        var more = (page * 10) < data.total;
        return {results: data.movies, more: more};
    }
},

just change the quietMillis to something bigger, as the documentation says:

quietMillis - Number of milliseconds to wait for the user to stop typing before issuing the ajax request


I guess quietMillis property was changed to delay in newer versions of select2:

https://select2.org/data-sources/ajax#rate-limiting-requests

$('select').select2({
  ajax: {
    url: '/example/api',
    delay: 250
  }
});