Many things have changed in v2.0 of cakephp removal of ajaxhelper is one of them in its plce we have a new helper called jshelper() to perform similar tasks here is how to use observe field with jshelper in cakephp 2.x
Where #category is the id of element which fires event and #videocontainer is the id of div which is updated of data from controller "contributors" and its action "changevideos"
<?php
echo $this->Js->get('#category')->event->('change',$this->JS->request(array(
'controller'=>'contributers',
'action'=>'changevideos'),
array(
'update'=>'#videocontainer',
'async'=>true,
'dataExpression'=>true,
'method'=>Post,
'data'=>$(this).serialize()'),
false))
?>
Where #category is the id of element which fires event and #videocontainer is the id of div which is updated of data from controller "contributors" and its action "changevideos"
but if i want a return, for example, i'm trying to change the values of a form when the option froma a select is changed.
ReplyDeleteyou can return json in that case from the page and then callback a function on success where you can set your form data.
Delete