Browse Source

add new options.type parameter for ajax helper. fixes #139

Igor Vaynberg 13 years ago
parent
commit
09f24fdda1
1 changed files with 6 additions and 5 deletions
  1. 6 5
      select2.js

+ 6 - 5
select2.js

@@ -250,17 +250,18 @@
                 requestSequence += 1; // increment the sequence
                 var requestNumber = requestSequence, // this request's sequence number
                     data = options.data, // ajax data function
-                    transport = options.transport || $.ajax;
-
+                    transport = options.transport || $.ajax,
+                    type = options.type || 'GET'; // set type of request (GET or POST)
+                
                 data = data.call(this, query.term, query.page, query.context);
 
-                if( null !== handler){
-                    handler.abort();
-                }
+                if( null !== handler) { handler.abort(); }
+                
                 handler = transport.call(null, {
                     url: options.url,
                     dataType: options.dataType,
                     data: data,
+                    type: type,
                     success: function (data) {
                         if (requestNumber < requestSequence) {
                             return;