Skip to content

Commit

Permalink
combine property changed
Browse files Browse the repository at this point in the history
  • Loading branch information
fitiskin committed Mar 8, 2018
1 parent e3633aa commit 303466e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/jquery.autocompleter.js
Expand Up @@ -94,7 +94,7 @@
* @param customValue [boolean] <false> "The name of object's property which will be used as a value"
* @param template [(string|boolean)] <false> "Custom template for list items"
* @param offset [(string|boolean)] <false> "Source response offset, for example: response.items.posts"
* @param combine [function] <$.noop> "Returns an object which extends ajax data. Useful if you want to pass some additional server options"
* @param combine [function] <null> "Returns an object with ajax data. Useful if you want to pass some additional server options or replace it at all"
* @param callback [function] <$.noop> "Select value callback function. Arguments: value, index"
*/
var options = {
Expand All @@ -117,7 +117,7 @@
customValue: false,
template: false,
offset: false,
combine: $.noop,
combine: null,
callback: $.noop
};

Expand Down Expand Up @@ -441,13 +441,14 @@
data.jqxhr.abort();
}

var ajaxData = $.extend(
{
limit: data.limit,
query: data.query
},
data.combine(data.query)
);
var ajaxData = {
limit: data.limit,
query: data.query
};

if (typeof data.combine === 'function') {
ajaxData = data.combine(ajaxData);
}

data.jqxhr = $.ajax({
url: data.source,
Expand Down

0 comments on commit 303466e

Please sign in to comment.