[英]How to pass csrf token in laravel 5.4 version for jqgrid?
Trying to pass csrf token from ace admin jqgrid template. 尝试从ace管理员jqgrid模板传递csrf令牌。
jQuery(grid_selector).jqGrid({
data: grid_data,
datatype: "local",
height: 250,
colNames:[' ', 'ID', 'Name', 'Email'],
colModel:[
{name:'myac', index:'', width:80, fixed:true, sortable:false,
resize:false,
formatter:'actions',
formatoptions:{
keys:true,
delOptions:{recreateForm: true, beforeShowForm:beforeDeleteCallback},
editformbutton:true,
editOptions:{recreateForm: true, beforeShowForm:beforeEditCallback, beforeSubmitCell: beforeSubmitCell}
}
},
{name:'id',index:'id', width:60, sorttype:"int", editable: true},
{name:'name',index:'name', width:150,editable: true, editoptions:{size:"30",maxlength:"50"}},
{name:'email',index:'email', width:150,editable: true, editoptions:{size:"30",maxlength:"50"}}
],
viewrecords : true,
rowNum:10,
rowList:[10,20,30],
pager : pager_selector,
altRows: true,
//toppager: true,
multiselect: true,
//multikey: "ctrlKey",
multiboxonly: true,
loadComplete : function() {
var table = this;
setTimeout(function(){
styleCheckbox(table);
updateActionIcons(table);
updatePagerIcons(table);
enableTooltips(table);
}, 0);
},
editurl: "{{ route('adminCrud', ['menu' => 'users', 'oper' => 'edit']) }}",
caption: "Users Listings"
});
function beforeSubmitCell(rowid,celname,value,iRow,iCol) {
alert('rowid => ', rowid);
return {token:'test'}
}
Its not entering to beforeSubmitCell, what should be done. 它没有进入beforeSubmitCell,应该怎么做。 How and where exactly csrf token should be passed for all crud operations?
对于所有Crud操作,应如何以及在何处确切地传递csrf令牌?
Add the csrf_token
to postData
and editData
options. 将
csrf_token
添加到postData
和editData
选项。 Something like below. 像下面这样。
jQuery(grid_selector).jqGrid({
postData: { "_token": {{ csrf_token() }} },
editData: { "_token": {{ csrf_token() }} },
....
....
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.