Ajax jquery Error cakephp 3.6.10 (Solved)

Like I said before, you have to read the CSRF to send in your post request from $.ajax() so your controller reads it and treats your request as a legit request from the web-app. I am not sure if cakePhP 3.6 has the CSRF component loaded by default. Check the resources on the website about the CSRF component.

https://book.cakephp.org/3.0/en/controllers/components/csrf.html

Ultimately, try to disable the component on your controller just for testing purposes, I DO NOT RECOMMEND to disable it on production.

public function beforeFilter(Event $event)
{
    $this->getEventManager()->off($this->Csrf);
}