php - How to render a partial view into 2 different DIVs, after AjaxSubmitButton on Yii? -
does know how render 2 different partials 2 differents div's in same page, after pressing chtml:ajaxsubmitbutton , using same controller?
i've searched around web far didn't find me.
thanks help.
you don't need ajaxsubmitbutton()
. ajaxbutton()
sufficient.
in view:
<?php echo chtml::ajaxbutton('click me', array('mycontroller/myaction'), array( 'datatype' => 'json', 'success' => 'js:function(res) { $("#div1").html(res.div1); $("#div2").html(res.div2); }', )); ?>
in controller:
public function actionmyaction() { echo json_encode(array( 'div1' => $this->renderpartial('div1', null, true), 'div2' => $this->renderpartial('div2', null, true), )); }
Comments
Post a Comment