위해 여기 내 코드입니다,하는 HTML DIV를 popolate하는 JSON 문자열을 사용하려고하지만, 작동하지 않는 것 같다?는 JSON popuplate의 HTML의 DIV
json으로는 PHP를 통해 생성되고이 잘 작동된다. 감사합니다.
$(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);
}
});
당신은 할 수 없어 ... 같은 비동기 방식에서 값을 반환 아약스 호출 ... http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-ajax-call –
약간 논외 볼 수 있지만, http://rog.ie/blog/ dugjs-A-JSONP - 투 - HTML 스크립트가 – roman