I have a simple wikipedia autocomplete using the wikipedia's API.
Currently it is working using the jQuery autocomplete Plugin and I want to make it using jQuery UI.
Can someone guide me through please?
Here is the fiddle of a working demo using the plugin: http://jsfiddle.net/VjLnv/
And here is the JS:
function attachWikiAutoComplete(expression) {
$("#artist").autocomplete("http://en.wikipedia.org/w/api.php", {
dataType: "jsonp",
parse: function(data) {
var rows = new Array();
var matches = data[1];
for( var i = 0; i < matches.length; i++){
rows[i] = { data:matches[i], value:matches[i], result:matches[i] };
}
return rows;
},
formatItem: function(row) { return row; },
extraParams: {
action: "opensearch",
format: "json",
search: function () { return $("#artist").val() } },
max: 10
});
}
Thanks alot