AJAX for CakePHP: A plugin to ease handling AJAX requests.
MIT License
Enjoy
Published by dereuromark about 1 year ago
Please test. Once this has been tested and approved, the stable release can be tagged.
Published by dereuromark almost 2 years ago
Published by dereuromark over 4 years ago
DRY (Don't repeat yourself) and easy AJAX handling.
Published by dereuromark over 4 years ago
Please help to finalize for stable release.
Published by dereuromark almost 5 years ago
Please help to finalize for stable release.
Published by dereuromark almost 5 years ago
Removed deprecations.
Published by dereuromark almost 5 years ago
This way the AjaxView automatically shares the AppView helpers loaded.
With CakePHP 3 now shifting helper loading from controller to view level this is a required chance at this point to have the AJAX templates being able to use the same helpers as the normal ones do.
Caution
All CakePHP 3 apps by now should have an AppView class present.
If you don't yet, please do that now before pulling this minor release.
Published by dereuromark over 5 years ago
Any non-null
values for error/success can now be used, so boolean true/false would now work.
Also allow "success" key to skip rendering, similar to "error". Sometimes a bool is not enough and you need to transport a more meaningful message here.
This can be used for edit-in-place AJAX or alike.
Published by dereuromark over 5 years ago
For usability reasons you might want to delete a row in a paginated table, without the need to refresh the whole page.
All you need to do here is
The default bake action usually already works perfectly:
public function delete($id = null) {
$this->request->allowMethod(['post', 'delete']);
$group = $this->Groups->get($id);
$this->Groups->delete($group);
$this->Flash->success(__('The group has been deleted.'));
return $this->redirect(['action' => 'index']);
}
The JSON response even contains the flash message and redirect URL in case you want to use that in your JS response handling.
A live example can be found in the Sandbox.
Published by dereuromark over 5 years ago
Adjusted JSON response to not contain invalid UTF8 part.
Published by dereuromark almost 6 years ago
Added AjaxMiddleware for newer CakePHP setups.
Big thanks to @Zuluru for enabling this.
Published by dereuromark over 6 years ago
CakePHP 3.5+ from here on due to PHP 7.2 compatibility.
Published by dereuromark almost 7 years ago
Published by dereuromark over 7 years ago
This release is for CakePHP 3.4+.
The responses in tests return a slightly different result, so they needed to be adjusted.
Published by dereuromark almost 9 years ago
With serialize true all vars are always serialized by default.
A change from 3.1. Now this is supported, as well.
Published by dereuromark about 9 years ago
The messages were only passed in JSON response for redirects, should also happen for non redirect responses, though.
Published by dereuromark about 9 years ago
This aims to be the first release, targeting CakePHP 3.1+
Use a previous commit for 3.0 (note that there there was no viewBuilder() yet).
It works for 3.1.1+ again to be exact as there were minor regressions in the way custom View classes were included in 3.1.0.