1
0
mirror of synced 2025-02-16 20:13:16 +03:00

added params ajax option to pass extra params to transport. fixes #492

This commit is contained in:
Igor Vaynberg 2013-02-09 01:20:19 -08:00
parent d56f43092b
commit 2f53c251d4

View File

@ -317,30 +317,38 @@ the specific language governing permissions and limitations under the Apache Lic
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)
type = options.type || 'GET', // set type of request (GET or POST)
params = {};
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, {
if (options.params) {
if ($.isFunction(options.params)) {
$.extend(params, options.params.call(null));
} else {
$.extend(params, options.params);
}
}
$.extend(params, {
url: url,
dataType: options.dataType,
data: data,
type: type,
cache: false,
traditional: traditional,
success: function (data) {
if (requestNumber < requestSequence) {
return;
}
// TODO 3.0 - replace query.page with query so users have access to term, page, etc.
// TODO - replace query.page with query so users have access to term, page, etc.
var results = options.results(data, query.page);
query.callback(results);
}
});
handler = transport.call(null, params);
}, quietMillis);
};
}