Hi all, I have a problem with an ajax call in my cakePhp 4.4.17 project. In my template file I launch a call to load a jquery datatable but I always get:
code :400
message :“‘_Token.fields’ was not found in request data.”
Depending on which component you use you are better of disabling the Security (and or FormProtection) Component for that specific action which requires you to use AJAX
Why it’s weird?
I amnew programmer in cakephp i think i wrong some step, I try to explain:
My company gave me an exstisting project in cakephp, and the problem was the very slow loading of the data. Looking through the code I saw that it loaded all data from controllers without using paginators. So my intention is to introduce this feature. But things get complicated, because the list of orders (this is what we are talking about) must be filtered for various states confirmed, unconfirmed, etc… and for each state I must have different lists to load in different datatables. All this is currently done through the index controller which then sends to the index template which loads, for each list, a different datatable, which is loaded in a special tab.
So I’m trying to introduce the paginate in this structure, how can I do it? my idea was to load the datatables via an ajax call that requires data only from the displayed list and therefore I need to pass the various parameters in post, or are there better solutions? Thank you
I personally would handle the adding/editing/saving of entries via its own AJAX call to its own controller action (and therefore own URL) which only returns minimal data if the action was successful or not.
The paginating, filtering und searching part should be handled by a different, GET based controller action