Hello everybody, I'm trying to build an autocomplete using jquery plugin autocomplete from this site.
Now I managed to achieve autocomplete using local results pre-loaded into website as a part of document ready function, its quite easy doing it localy.
Here is with what I struggle with, pulling results from php file. Here is how I tried:
$("#post_tags").autocomplete("http://localhost/tags/filter", {
width: 260,
selectFirst: false,
highlight: false,
multiple: true,
multipleSeparator: " ",
scroll: true,
formatItem: function (row, position, totalReturned, searchTerm){
return row[0];
},
formatResult: function(row, position, totalReturned){
return row[0].replace(/(<.+?>)/gi, '');
}
}).result(function(event, data, formatted){
$("<li>").html( !data ? "No match!" : "Selected: " + formatted)
.appendTo("#result");
});
When I manually go to http://localhost/tags/filter/p
I get results php,asp because they contain letter p .
How can I make this work with autocomplete, I mean its quite easy using native php see this file , meaning I'm only passing something to the search file like this search?q=p
and I get back the results. Since I'm using codeigniter the things are a bit different and I don't retrieve any results using jquery code above.
I'm stuck with this since last night I cannot yet offer a bounty and I really need it for monday. Thank you