如何通过单选按钮提交表单而不刷新页面?
通过刷新整个页面来提交
<?php echo $form->radioButtonList($model,'yesno',
array('Y'=>"<img src=\"".Yii::app()->baseUrl."/images/site/yes.png\" id=\"yes-i\"/> ",
'N'=>"<img src=\"".Yii::app()->baseUrl."/images/site/no.png\" id=\"no-i\"/>"),array(
'class'=>'fire-toggle','labelOptions'=>array('style'=>'display:inline'),
'separator'=>' ',
'onclick'=>Chtml::ajax(array(
'success'=>"$('#yesno-form').submit()")))); //This doesn't work..
?>
答案 0 :(得分:0)
更新您的onclick,如下所示,
'onclick' => 'js: function(){$.post(\'<url>\', $(\'#<form-id>\').serialize(), function(data){alert(data)})}'
设置并适当地