I am trying to use an JSON string to popolate an html div, here's my code, but it seems not working, I still cannot realize why, there's some suggestions?
The JSON is created via PHP and it is working fine. Thank you.
$(document).ready(function(e) {
var Currencies = function(){
$.ajax({
url:"js/php/users.php",
success:function(data){
return{
getMyJson: function(data){
return(data);
}
}
}
});
}(); // execute the function when the MyObj variable is initialized.
});
$('#autocomplete').autocomplete({
lookup: Currencies.getMyJson(),
onSelect: function (suggestion){
var thehtml = '<strong>Currency Name:</strong> ' + suggestion.nome + ' <br> ';
$('#outputcontent').html(thehtml);
}
});