在以下代码中
Data:flag列Need需要两种类型的数据,一种是标志,即'Y'或'N'和 第二个是id
尝试很多东西,但是没有用。希望你们能理解我想说的话
也可以在类的return函数中发送安全ID 函数secureToken :: createtoken(+ data +)像这样
尝试一切,但无法解决问题
echo json_encode(array(
'data' => $data1,
));
"ajax": 'libs/models/get-product.php',
deferRender: true,
deferLoading: 50,
"columns": [
{ "data":"id",
render: function (data, type, row, meta) {
return meta.row + meta.settings._iDisplayStart + 1;
}
},
{ "data": "image",
"render":function(data){
return "<img width='50px' src=../uploads/product/"+data+">";
}
},
{ "data": "name" },
{ "data": "model_no" },
{ "data": "price_per_unit" },
{"data":"id",
"render":function(data){
return "<a href='edit_product.php?token=<?=$_GET['token']?>&pid="+data+"' class='btn btn-success'><i class='icon md-edit'></i></a>";
}
},
{
"data":"flag",
"render":function(data){
if(flag == 'Y'){
return "<label class='switch'><input name='prodonoff' type='checkbox' checked value='"+data+"' ref='<?=secureToken::createtoken("off")?>'><span class='slider round'></span></label>";
}else{
return "<label class='switch'><input name='prodonoff' type='checkbox' value='"+data+"' ref='<?=secureToken::createtoken("on")?>'><span class='slider round'></span></label>";
}
}
},
]