Reputation: 229
I am trying to run a query for autosearch options using jquery UI autocomplete using the code ,
$("#srchBox").autocomplete({
source: "http://localhost:8080/cleo-primer/rest/elements/search?uid=1"
});
When I run it, it sends the query, GET http://192.168.2.243:8080/cleo-primer/rest/elements/search?uid=1&term=in
,
but the original query should be GET http://192.168.2.243:8080/cleo-primer/rest/elements/search?uid=1&query=in
,
The part after query is the input that we type in searchbox.. Is it possible to change the word "term" to "query"??
Upvotes: 0
Views: 155
Reputation: 39704
Change callback
function and handle responses:
$("#srchBox").autocomplete({
source: function(request, response) {
$.get('http://192.168.2.243:8080/cleo-primer/rest/elements/search', {
query: request.term,
uid: 1
}, function(data) {
// process data
});
}
}).data("autocomplete")._renderItem = function(ul, item) {
$(ul).attr('id', 'search-autocomplete');
return $("<li class=\""+item.type+"\"></li>")
.data( "item.autocomplete", item )
.append("<a href=\""+item.url+"\">"+item.title+"</a>").appendTo(ul);
};
Upvotes: 3