diff --git a/select2.js b/select2.js index 6a17c933..cc162fa8 100755 --- a/select2.js +++ b/select2.js @@ -273,7 +273,7 @@ query.callback(data); }); } else { - if (!opts.query && opts.ajax) { + if (!("query" in opts) && opts.ajax) { opts.query = (function () { var timeout, // current scheduled but not yet executed request requestSequence = 0, // sequence used to drop out-of-order responses @@ -438,7 +438,8 @@ var results = this.results, more = results.find("li.select2-more-results"), below, // pixels the element is below the scroll fold, below==0 is when the element is starting to be visible - offset = -1; // index of first element without data + offset = -1, // index of first element without data + page = this.resultsPage+1; if (more.length === 0) return; @@ -446,7 +447,7 @@ if (below <= 0) { more.addClass("select2-active"); - this.opts.query({term: this.search.val(), page: (this.resultsPage + 1), callback: this.bind(function (data) { + this.opts.query({term: this.search.val(), page: page, callback: this.bind(function (data) { var parts = [], self = this; $(data.results).each(function () { parts.push("