I try to get an instant search with jquery ui autocomplete, I want to add link onclick result.
JScript
$("#searchinput").autocomplete({
source: "search/get_searchdata",
select:function(e,ui) {
location.href = ui.item.the_link;
};
});
HTML
<div class="ui-widget">
<input id="searchinput">
</div>
The script work and show me results from array:
Array
[
{
"label": "Apple annuncia OS X El Capitan",
"the_link": "../../../post/2"
},
{
"label": "Apple l'Phone flessibile",
"the_link": "../../../post/5325"
},
{
"label": "iCloud Apple, attacco hacker in Cina",
"the_link": "../../../post/5637"
}
]
/* Lint by jsonlint.com */
But when i click a result the page not change.
Note: I use jQuery 1.9.1 version.