Hello, I am using the typeahead feature in the following way.
Typeahead shows the initialized list and also items added through push but not items added through AJAX.
Here is the code, any help is appreciated.
$(function(){
var currencies = [" ", "Rang", "Subs", "super"];
var currencies1 = [" ", "Samy", "MR", "happy"];
currencies.push("elephant");
currencies1.push("aane");
var path = "https://api.appery.io/rest/1/code/eba6bc3e-0d8f-48df-9186-2b173fa7ee92/exec";
$.getJSON(path, {}, function (data) {
$.each(data, function (i, field) {
currencies.push("pet"+i);
currencies1.push("good"+i);
});
});
$('#autocomplete').autocomplete({
lookup: currencies,
onSelect: function (suggestion) {
/* var thehtml = '<strong>Currency Name:</strong> ' + suggestion.value + ' <br> <strong>Symbol:</strong> ' + currenciesG[currenciesG.indexOf(suggestion.value)];*/
/* var thehtml = '<strong>Currency Name:</strong> ' + suggestion.value + ' <br> <strong>Symbol:</strong> ' + suggestion.data; */
$('#outputcontent').html(thehtml);
var a = document.getElementById("playerName");
a.value = suggestion.value;
var b = document.getElementById("playerId");
b.value = suggestion;
}
});
});
Hello, I am using the typeahead feature in the following way. Typeahead shows the initialized list and also items added through push but not items added through AJAX. Here is the code, any help is appreciated.