Ajax jquery cakephp 3

Try dont active app debug, change to false, if error again u can add layout ajax on controller, if error again u must send token csrf from ajax…
How to send csrf look this…
First you u must request token or csrf with code
json_encode($this->request->getParam(’_csrfToken’))
Step two
Get the value to variable javascript or var
And send with data from ajax u can add
headers:{‘X-CSRF-Token’:variable_csrf }
Good luck