Skip to content

Commit 38dae78

Browse files
committed
Merge pull request select2#325 from sambomartin/master
ajax - support traditional param serialization in ajax calls
2 parents af6a3f5 + 31cc5ed commit 38dae78

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

select2.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@
277277
* @param options.url url for the data
278278
* @param options.data a function(searchTerm, pageNumber, context) that should return an object containing query string parameters for the above url.
279279
* @param options.dataType request data type: ajax, jsonp, other datatatypes supported by jQuery's $.ajax function or the transport function if specified
280+
* @param options.traditional a boolean flag that should be true if you wish to use the traditional style of param serialization for the ajax request
280281
* @param options.quietMillis (optional) milliseconds to wait before making the ajaxRequest, helps debounce the ajax function if invoked too often
281282
* @param options.results a function(remoteData, pageNumber) that converts data returned form the remote request to the format expected by Select2.
282283
* The expected format is an object containing the following keys:
@@ -297,6 +298,7 @@
297298
var requestNumber = requestSequence, // this request's sequence number
298299
data = options.data, // ajax data function
299300
transport = options.transport || $.ajax,
301+
traditional = options.traditional || false,
300302
type = options.type || 'GET'; // set type of request (GET or POST)
301303

302304
data = data.call(this, query.term, query.page, query.context);
@@ -308,6 +310,7 @@
308310
dataType: options.dataType,
309311
data: data,
310312
type: type,
313+
traditional: traditional,
311314
success: function (data) {
312315
if (requestNumber < requestSequence) {
313316
return;

0 commit comments

Comments
 (0)