php - Datatables remove backslash(\) characters from data -
this codes use datatables jquery plugin send data via ajax server:
$('#alllessonattachmentstable').datatable({ processing: true, serverside: true, "bsort": false, "responsive": true, ajax: { url: 'http://lms.dev/admin/getfileslist', data: function (d) { d.id = '8', d.type = 'app\lesson' } }, columns: [ {data: 'checkbox', name: 'checkbox', "width": "20px"}, {data: 'picture', name: 'picture', 'classname': 'text-center'} ] });
as see, type
parameter sent server contain \
(backslash) character. when retrieve in laravel back-end backslash character removed.
what problem , why removed?
javascript has \
escape character. might need use \\
escape it. change code to:
d.type = 'app\\lesson'
in console itself, can see how javascript treats \
, \\
:
if whole thing generated php, may try using php's function addslashes()
generate string friendly output.
Comments
Post a Comment