-
Book Overview & Buying
-
Table Of Contents
CakePHP 2 Application Cookbook - Third Edition
By :
It's no secret that Ajax has revolutionized web development and helped developers build and deliver engaging applications which have a real-time feel to them.
In this recipe, we'll look at how easy it is to handle Ajax requests in CakePHP and give you an introduction to the possibilities at your fingertips.
For this recipe, we'll reuse the books database table from the previous chapter. We'll also need a view for our inventory_index(). action, so create a file named inventory_index.ctp in app/View/Books/.
Perform the following steps:
Add the following beforeFilter() method to the BooksController class:
public function beforeFilter() {
parent::beforeFilter();
if ($this->request->is('ajax')) {
$this->response->disableCache();
}
}In the same class, add the following inventory_index() method (we will utilize the inventory prefix added in the previous chapter):
public function inventory_index() {
$this->set('books', $this...
Change the font size
Change margin width
Change background colour