We have CSRF restriction and how can I add the Ajax header with CSRF token in order to perform the inline edit action? Thanks.
1 Answers
You can set following for token:value — X-CSRF-Token', 'abc'
$grid["loadBeforeSend"] = "function(jqXHR) { jqXHR.setRequestHeader('X-CSRF-Token', 'abc' );}";
$grid["edit_options"]["ajaxEditOptions"]["beforeSend"] = "function(jqXHR) { jqXHR.setRequestHeader('X-CSRF-Token', 'abc' );}";
$grid["edit_options"]["ajaxEditOptions"]["beforeSend"] = "function(jqXHR) { jqXHR.setRequestHeader('X-CSRF-Token', 'abc' );}";
$g->set_options($grid);
If you can manage COOKIE based csrf, it would make things more simpler.
Your Answer