【发布时间】:2017-01-03 08:30:25
【问题描述】:
尊敬的专家需要帮助如何在变量 tbaris 之间添加 foreach :
function show_infouser(Kode)
{ save_method = 'update';
$('#form')[0].reset(); // reset form on modals
$('.form-group').removeClass('has-error'); // clear error class
$('.help-block').empty(); // clear error string
$.ajax({url : "<?php echo site_url('infouser/ajax_user')?>/" + Kode,
type: "GET",
dataType: "JSON",
success: function(data){
if (data == null)
{ showConfirmButton: false }); }
else {
// want to show foreach in here
var tbaris = '<tr><td style="width:3px; font-size:11px;"><center>'+data.No+'</center></td>';
tbaris += '<td style="width:3px; font-size:11px;"><center>'+data.Name+'</center></td>';
tbaris += '<td style="width:3px; font-size:11px;"><center>'+data.Job+'</center></td>';
tbaris += '<td style="width:3px; font-size:11px;"><center>'+data.Status+'</center></td>';
$('#tableuser tbody').html(tbaris);
$('#modal_form1').modal('show');
$('.modal-title').text('SHOW ROOM');}},
error: function (jqXHR, textStatus, errorThrown)
{
alert('Error get data from ajax' + errorThrown);
alert('Error get data from ajax' + textStatus);
alert('Error get data from ajax' + jqXHR);
}
});
}
【问题讨论】:
-
还发布您的控制器....代码。您如何从服务器发回数据?
标签: arrays ajax codeigniter