I have the following code.
The ajax query works, and the data returned from the server is a valid json.
I succeeded to make the autocomplete dropdown work with a remote data source, through a request like this : http://jqueryui.com/demos/autocomplete/#remote.
My problem is that the data returned from the jquery.ajax doesn’t show in the autocomplete. Anyone can help? thks.
jQuery( "#input_2_5" ).autocomplete({
source: function(request, response){
jQuery.ajax({
url: "url/wp-admin/admin-ajax.php",
type:'POST',
dataType: 'json',
data:{
action: 'word_autocomplete'
},
success: function(data) {
return data;
}
});
}
});
jQuery( “#input_2_5” ).autocomplete({
source: function(request, response){
});