【发布时间】:2014-08-22 06:13:52
【问题描述】:
我正在尝试在 CodeIgniter 中使用 jquery-jtabel,但在将变量 bulantahun 从视图/ajax 传递到控制器时遇到问题。这是我的代码。
//this is the ajax code
$('#TableContainer').jtable({
title: 'Absensi',
paging: true,
sorting: true,
defaultSorting: 'bulanTahun ASC',
selecting: true,
multiselect: true,
selectingCheckboxes: true,
actions: {
listAction: base_url+'Absensi_controller/listRecord',
createAction: base_url+'Absensi_controller/create',
updateAction: base_url+'Absensi_controller/update',
deleteAction: base_url+'Absensi_controller/delete'
},
// the field is here
$('#TableContainer').jtable('load',{
bulantahun:$("#from").val()
});
//and this is my code in Controller
function create()
{
$bulantahun = $this->input->post('bulantahun'); //failed to post this value
//my code here
}
【问题讨论】:
-
尝试在 get like createAction 中发送数据:base_url+'Absensi_controller/create&id='bulantahun'
-
以及如何在 Controller 中获取值? $this->input->get('bulantahun'),不是吗?
标签: php codeigniter jquery-jtable