I've been using this tutorial to make an autocomplete function. (UPDATE: I ditched the jQuery UI Autocomplete route because there isn't much documentation for it.) The following code works (FINALLY). I also managed to get the suggestion links to work as well. I plan to make some type of blog post to help other noobs like myself figure it out. :)
$("#q").result(function(event, data, formatted) {
document.location.href = row.url;
});
$("#q").autocomplete("/a_complete.php", {
dataType: 'json',
parse: function(data) {
var rows = new Array();
for(var i=0; i<data.length; i++){
rows[i] = { data:data[i], value:data[i].pos, value:data[i].team, value:data[i].url, result:data[i].value };
}
return rows;
},
formatItem: function(row, i, n) {
return '<a href="' + row.url + '">' + row.value + ' <span style="float: right; font-size: 11px; color: gray; padding-right: 10px;"><strong style="">' + row.pos + '</strong> ' + row.team +' </span></a>';
},
extraParams: {
q: '',
limit: '',
sport: '<?=$sport?>',
featureClass: 'P',
style: 'full',
maxRows: 15,
term: function () { return $("#q").val() }
},
max: 25,
scrollHeight: 300,
width: 200
});