我有这个按钮
<a class="btn btn-sm btn-success" href="javascript:void(0)" title="info" onclick="delete_province('."'".$info->ID."'".')"><i class="glyphicon glyphicon glyphicon-question-sign"></i> Show File</a>';
我想用这样的东西改变那个按钮功能
<a href = '<?php echo base_url().'Employees/updatepersonalinfo/'.$data; ?>' class = 'btn btn-info pull-right fa fa-edit'>  Update</a>
请注意这里
echo base_url().'Employees/updatepersonalinfo/'.$data;
我在网址上传递数据,以便我使用函数$this->uri->segment()
如何使按钮像href一样工作?还有其他任何方式,模板不再加载只是一些div?提前谢谢
以及我要传递的.$data
来自json?
继续使用附加代码
这是带按钮的控制器
public function index()
{
$data['content_view'] = 'TaxValues/taxvalues_read';
$this->templates->admin_template($data);
}
public function ajax_list()
{
$list = $this->TaxValues_Model->get_datatables();
$data = array();
$no = $_POST['start'];
foreach ($list as $info) {
$no++;
$row = array();
$row[] = $info->RANGE_NO;
$row[] = $info->TAX;
$row[] = $info->PERCENTAGE." %";
$row[] = $info->VALUE;
$row[] = $info->FREQUENCY;
//add html for action
$row[] = '<a class="btn btn-sm btn-primary" href="javascript:void(0)" title="Edit" onclick="edit_provinces('."'".$info->TAX_ID."'".')"><i class="glyphicon glyphicon-pencil"></i> Edit</a>
<a class="btn btn-sm btn-danger" href="javascript:void(0)" title="Delete" onclick="delete_province('."'".$info->TAX_ID."'".')"><i class="glyphicon glyphicon-trash"></i> Delete</a>';
$data[] = $row;
}
$output = array(
"draw" => $_POST['draw'],
"recordsTotal" => $this->TaxValues_Model->count_all(),
"recordsFiltered" => $this->TaxValues_Model->count_filtered(),
"data" => $data,
);
//output to json format
echo json_encode($output);
}
我想传递$info->TAX_ID
,例如,我想访问我现有的更新代码,
更新的控制器功能
public function updateinfo(){
$data['content'] = $this->TaxValues_Model->info();
$data['content_view'] = 'TaxValues/edit';
$this->templates->admin_template($data);
}
更新的模型功能
public function info(){
$query = $this->db->get_where('emp_fi_p', array('ID_NUM' => $this->uri->segment(3)));
return $query->row();
}