瀏覽代碼

Set all AJAX parameters as query string parameters

This will now pass all of the AJAX parameters into the AJAX request as
query string parameters, so now the page number (and other variables)
will be set automatically. This can still be overridden in `ajax.data`
to pass anything else, but this should make it easier for the most
common case.

This closes https://github.com/select2/select2/issues/3548
This closes https://github.com/select2/select2/pull/3552
Kevin Brown 10 年之前
父節點
當前提交
7c47912b73
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/js/select2/data/ajax.js

+ 2 - 2
src/js/select2/data/ajax.js

@@ -18,9 +18,9 @@ define([
   AjaxAdapter.prototype._applyDefaults = function (options) {
   AjaxAdapter.prototype._applyDefaults = function (options) {
     var defaults = {
     var defaults = {
       data: function (params) {
       data: function (params) {
-        return {
+        return $.extend({}, params, {
           q: params.term
           q: params.term
-        };
+        });
       },
       },
       transport: function (params, success, failure) {
       transport: function (params, success, failure) {
         var $request = $.ajax(params);
         var $request = $.ajax(params);