<script type="text/javascript">
function get_test_json(){
var HTML = "";
var ClientHTML = "";
var nomor = 1;
HTML = '<table data-role="table" id="table-custom-2" data-mode="columntoggle" class="ui-body-d ui-shadow table-stripe ui-responsive" data-column-btn-theme="a" data-column-btn-text="Pilih Kolom" data-column-popup-theme="a">';
HTML += "<thead>";
HTML += '<tr class="ui-bar-a">';
HTML += '<th data-priority="2">No</th>';
HTML += '<th data-priority="3">Foto</th>';
HTML += '<th>Nama</th>';
HTML += '<th data-priority="5">Keterangan</th>';
HTML += '</tr>';
HTML += '</thead>';
HTML += '<tbody>';
$.getJSON("http://localhost/JSON_test/my_json_list.php", function(person){
$.each(person, function(key, value){
$.each(value, function(names, specs){
ClientHTML += '<tr>';
ClientHTML += '<th>'+nomor+'</th>';
ClientHTML += '<td><img src="" alt="" height="" width=""></td>';
ClientHTML += '<td>'+names+'</td>';
ClientHTML += '<td><a href="http://localhost/4r.mobile.kemensos/profil_peneliti.html">'+specs+'</a></td>';
ClientHTML += '</tr>';
nomor = nomor+1;
});
});
});
alert(ClientHTML); // this is the problem
HTML += ClientHTML;
HTML += '</tbody>';
HTML += '</table>';
document.getElementById("test").innerHTML = HTML;
}
</script>
当我删除警报时,ClientHTML 变量为空。
我很抱歉我的英语不好和一些转储代码,我是新手,
谢谢你的帮助