I am having a ajax post call to a cakePhp Controller:
$.ajax({ type: \"POST\", url: \'locations/add\', data: {
RequestHandler is not required to send json. In controller's action:
$this->viewBuilder()->setClassName('Json'); $result = ['result' => $success ? 'success' : 'error']; $this->set($result); $this->set('_serialize', array_keys($result));