Ajax implementation on CakePHP @ 3

Recently i have started another CakePHP project. i found that the example in Ajax implementation on CakePHP @ 2 should be changed as follow.
ajax_controller.php

<?php
Class AjaxController extends AppController {
var $name = 'Ajax';
var $helpers = array('Form','Html','Javascript', 'Ajax');
var $components = array('RequestHandler');

function afterAjaxAction () {
// get the $this->data to collect the form information
// save the object to database
// render the after_ajax_call.ctp
$this->render('/elements/layout/after_ajax_call');
}
}

 
view.ctp

<?php echo $form->create(); ?>
<?php echo $form->input(...); ?>
<?php echo $form->input(...); ?>
<?php echo $form->input(...); ?>
<?php echo $ajax->submit('Submit', array('url' => array('controller'=>'ajax', 'action'=>'afterAjaxAction'), 'update'=>'ajaxDiv', 'before' => )); ?>
<?php echo $form->end(); ?>

 
Done =)
Filed under: CakePHP Tagged: AJAX, CakePHP