So I have my JavaScript making an Ajax call to /my_controller/ajax_action but then in the controller I don\'t know what to do to output something back to the Ja
Easiest way I found was to disable the automatic rendering:
function ajax_action($data = null) {
if($this->RequestHandler->isAjax()) {
$this->autoRender = false;
//process my data and return it
return $data;
} else {
$this->Session->setFlash(__('Not an AJAX Query', true));
$this->redirect(array('action' => 'index'));
}
}