This is a working example with Tag-it and autocomplete. Check it out, look how it works, be sure to take the latest libraries and customize it to your needs:
HTML
<ul id="mytags" >
</ul>
JS
$("#mytags").tagit({
autocomplete: { source: function( request, response ) {
$.ajax({
url: "http://ws.geonames.org/searchJSON?username=foobar",
dataType: "jsonp",
data: {
featureClass: "P",
style: "full",
maxRows: 12,
name_startsWith: request.term
},
success: function( data ) {
response( $.map( data.geonames, function( item ) {
return {
label: item.name + (item.adminName1 ? ", "
+ item.adminName1 : "") + ", " + item.countryName,
value: item.name
}
}));
}
});
}, minLength: 2 }
});