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
try this:
within your view folder for the corresponding controller(my_controller) make a folder named json and place a file named index.ctp and within that ctp file write this code:
within your my_controller in index() wrote this code:
$this->set('yourVariableNameReturnedFromController', $this->YOURMODEL->find('all'));
within your app_controller.php(if not exist you have to made it) write this code
function beforeFilter(){
if ($this->RequestHandler->ext == 'json') {
Configure::write('debug', 0);
}
}