I'm using MagicSuggest for auto completing an input text, the autocomplete feed its very big so i cant download it complete, in their example they provide this code:
JAVASCRIPT
$(document).ready(function() {
var jsonData = [];
var cities = 'New York,Los Angeles,Chicago,Houston,Paris,Marseille,Toulouse,Lyon,Bordeaux,Philadelphia,Phoenix,San Antonio,San Diego,Dallas,San Jose,Jacksonville'.split(',');
for(var i=0;i<cities.length;i++) jsonData.push({id:i,name:cities[i],status:i%2?'Already Visited':'Planned for visit',coolness:Math.floor(Math.random() * 10) + 1});
$('#ms3').magicSuggest({
selectionPosition: 'bottom',
renderer: function(city){
return '<div>' +
'<div style="font-family: Arial; font-weight: bold">' + city.name + '</div>' +
'<div>Cooooolness: ' + city.coolness + '</div>' +
'</div>';
},
minChars: 1,
selectionStacked: true,
data: jsonData
});
HTML
<h3>Stacking in bottom, ajax source (type 1 char to load)</h3>
<input id="ms3" style="width:400px;" type="text"/>
If you like, here is a JSFIDDLE. This is working great, but again, the data is complete loaded (in this case hardcoded), is there a way to load the data over ajax based on the user input (each time it changes)? I don't care about the php side since im very capable on that side, but in the front end im very new.