我加载了我想通过ajax JSON请求从数据库中显示获取记录的视图.但是它没有显示记录.
这是我的观看代码
<div class="col-md-6" id="hodm_table">
<table class="table table-striped table-hover table-responsive">
<thead>
<tr>
<th>Task Name</th>
<th>Director</th>
<th>Duration</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php foreach($result as $hodm) { ?>
<tr>
<td><?php echo $hodm->t_name;?></td>
<td><?php echo $hodm->director;?></td>
<td><?php echo $hodm->duration;?></td>
<td><?php echo $hodm->status;?></td>
<?php } ?>
</tbody>
</table>
</div>
</div>
<script type='text/javascript' language='javascript'>
$(document).ready(function(){
$.ajax({
url:"<?php echo base_url();?>digital/dashboard/dig_short_hodm_table",
type: 'POST',
dataType: 'JSON',
success:function (data) {
$('#hodm_table').html(data);
}
});
event.preventDefault();
});
</script>
Run Code Online (Sandbox Code Playgroud)
这是我的模特
public function get_hodm()
{
return $this->db->get("hodm");
}
Run Code Online (Sandbox Code Playgroud)
这是我的控制器
public function dig_short_hodm_table(){ …Run Code Online (Sandbox Code Playgroud)