I am facing a problem when a try to submit a form data to edit using ajax. when I debug() $this->request->data I get an empty array(). My form is in a modal window, that shows up when the user clicks in a edit button. NB: When is a non ajax way it works well.
My controller method:
public function editarModal() {
debug($this->request->data); // This value is empty when I use ajax
if($this->RequestHandler->isAjax()) {
debug($this->RequestHandler->isAjax());
if($this->Concurso->save($this->request->data)) {
$this->render('sucesso', 'ajax'); // returns a message to the user
} else {
$this->render('erro', 'ajax');
}
} else {
if($this->Concurso->save($this->request->data)) {
//$this->Flash->success('Dados submetidos com exito!');
return $this->redirect(array('action' => 'index'));
}
}
}
I hope you can give me an idea of why I’m receiving this empty array(), Thanks in advance!