There is not much secret, that is the path you are following using the Jshelper. First you need to include the helper in his Controller
:
public $helpers = array('Js' => array('Jquery'));
And to illustrate, you have a method so that will return one array
containing some parameters:
public function ajax() {
$this->render(false, false);
debug($this->request->params);
}
To View
corresponding to another Controller (teste_ajax
, for example) let’s put only one button, passing two parameters, foo and bar:
echo $this->Js->submit('Enviar', array('update' => '#response', 'url' => array('action' => 'ajax', 'foo', 'bar')));
echo $this->Html->script('jquery');
echo $this->Js->writeBuffer(array('inline' => 'true'));
echo "<div id='response'></div>";
Note that I set to display my answer in the element #sponse, which is mine div
last-line.
See is clear and you can understand to be able to implement according to your needs.
Put the code you tried, will make it easier to try to visualize the problem and help.
– Joao Paulo