I am trying to modify this example of jQuery UI to accept the 2-dimensional JSON data. http://jqueryui.com/demos/autocomplete/#remote-with-cache
var cache = {}, lastXhr;
$( "#birds" ).autocomplete({
minLength: 2,
source: function( request, response ) {
var term = request.term;
if ( term in cache ) {
response( cache[ term ] );
return;
}
lastXhr = $.getJSON( "search.php", request, function( data, status, xhr ) {
cache[ term ] = data;
if ( xhr === lastXhr ) {
response( data );
}
});
}
});
How would I modify this to use the 'name' value in JSON data like this:
[{"name":"TEST1","slug":"blah-blah"},{"name":"TEST","slug":"example-slug-here"}]