Hello @jawfin, would you share the working code/files? Are you using any helpers?
I’m struggling to understand:
- where the $csrfToken is first established because simple() isn’t called until the users submits the form
- other tutorials I’ve seen reference the controller & action - simple() - in the ajax url field and your code doesn’t
eg. website.com + <?=this ->Url->build([“controller”=>“Test”,“action”=>“simple”]);
I haven’t been able to get to get an ajax form to work and I’ve been through a bunch of different examples but nothing seems to work for CakePHP4. So I really appreciate any help you can give me or if you could point me in the direction to understanding!!
(I’m trying to save information that a user inputs on a services page (db: services) to a database of users, so it’s a cross post form. Basically, I want to allow a user to fill out a search field and store his email in another database).