From 67af5a43f17600e0b135f13162b1d7ea65c68e40 Mon Sep 17 00:00:00 2001 From: Jason Purcell Date: Fri, 25 Jan 2013 12:40:17 -0500 Subject: [PATCH] ajax url function is now passed same arguments and called with same context as data option --- select2.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/select2.js b/select2.js index b242c0c7..818507b1 100644 --- a/select2.js +++ b/select2.js @@ -286,16 +286,18 @@ the specific language governing permissions and limitations under the Apache Lic requestSequence += 1; // increment the sequence var requestNumber = requestSequence, // this request's sequence number data = options.data, // ajax data function + url = options.url, // ajax url string or function transport = options.transport || $.ajax, traditional = options.traditional || false, type = options.type || 'GET'; // set type of request (GET or POST) data = data ? data.call(this, query.term, query.page, query.context) : null; + url = (typeof url === 'function') ? url.call(this, query.term, query.page, query.context) : url; if( null !== handler) { handler.abort(); } handler = transport.call(null, { - url: ((typeof options.url === 'function')?options.url():options.url), + url: url, dataType: options.dataType, data: data, type: type,