如何从php/codeigniter中的datatables jquery中读取id行?

如何从php/codeigniter中的datatables jquery中读取id行?,php,ajax,codeigniter,datatables,Php,Ajax,Codeigniter,Datatables,我想在将行id发送到php代码后将其发送到,但是我使用datatables jquery插件,但是我将id显示到datatables中,但是datatables生成的是td而不是输入。如果是的话,在php中阅读它会很容易,但是我如何才能在php中读取我的数据表行id。。。我试过$u POST,但我不能,因为我在tds上没有名字。另一件事我用的是codeigniter。一旦我可以读取我的id行,我就可以使用它来更新我的项目 桌子 控制器 public function datatable(){

我想在将行id发送到php代码后将其发送到,但是我使用datatables jquery插件,但是我将id显示到datatables中,但是datatables生成的是td而不是输入。如果是的话,在php中阅读它会很容易,但是我如何才能在php中读取我的数据表行id。。。我试过$u POST,但我不能,因为我在tds上没有名字。另一件事我用的是codeigniter。一旦我可以读取我的id行,我就可以使用它来更新我的项目

桌子

控制器

public function datatable(){
        $array = $this->products->datatable();
        $this->json($array);
        $data = array();
        foreach ($array as $rows){
            array_push($data, array(
                $rows['id'],
                $rows['descripcion'],
                $rows['precio_compra'],
                $rows['precio_venta'],
                $rows['precio_mayoreo'],    
                $rows['existencia'],
                $rows['status']
            ));
        }
        $this->json(array('data' => $data));
    }
public function updateProduct($data){
        $this->db->update('storelte_articulos',$data);
        $this->db->where('id');
    }
更新控制器

public function datatable(){
        $array = $this->products->datatable();
        $this->json($array);
        $data = array();
        foreach ($array as $rows){
            array_push($data, array(
                $rows['id'],
                $rows['descripcion'],
                $rows['precio_compra'],
                $rows['precio_venta'],
                $rows['precio_mayoreo'],    
                $rows['existencia'],
                $rows['status']
            ));
        }
        $this->json(array('data' => $data));
    }
public function updateProduct($data){
        $this->db->update('storelte_articulos',$data);
        $this->db->where('id');
    }

您需要将ID放入输入中,但将其设置为隐藏。这样,数据不会显示给最终用户,但可以通过post数据获得

由于可以通过开发人员工具/inspect看到它,我建议对它进行编码以显示,然后对其进行解码以用于数据库查询