Reputation: 131
In official documentation page i find below code http://jqueryui.com/autocomplete/#remote
$( "#birds" ).autocomplete({
source: "search.json",
minLength: 2,
select: function( event, ui ) {
log( ui.item ?
"Selected: " + ui.item.value + " aka " + ui.item.id :
"Nothing selected, input was " + this.value );
}
});
What i need is after ajax call is made to search.json , I need to store the returned json data from remote in a variable and then call a function.How to do it ? thanks.
Upvotes: 0
Views: 2651
Reputation: 1036
Initialize the autocomplete with the response callback specified:
$( ".selector" ).autocomplete({
response: function( event, ui ) {}
});
Bind an event listener to the autocompleteresponse event:
$( ".selector" ).on( "autocompleteresponse", function( event, ui ) {} );
Source: http://api.jqueryui.com/autocomplete/#event-response
Upvotes: 1