I've been at this for a while and I'm making very slow progress mostly because my jquery skills need improvement, I am trying though :)
I have this code:
jQuery(function() {
jQuery("input#search").autocomplete({
minLength: 2,
source: function(request, response) {
jQuery.post("index.php?option=com_eat&view=search&format=raw", {
"'.$token.'": "1",
search_string: request.term
}, function(data) {
response( jQuery.map( data, function( item ) {
return {
value: item.name,
url: item.url
}
}));
}, "json");
}
});
});
The return from the post is json in the form:
data.url = some_url;
data.name = some_name;
I want to have the autocomplete populated by the json data.name and if any of these are clicked it directs the page to data.url.
The real issue for me is getting the JSON data from the response into the autocomplete results. There aren't too many examples of this on the web that suit my circumstances, well none that I can find.
Thanks for any help.