[已解决]偶有一个表单要连续提交相似的值,想每次提交后... [ 新手入门 ]
偶有一个表单要连续提交相似的值,想每次提交后,当前已填写的内容不被清空,除了用session之类的保存这些值,是不是还有其他的办法?
共 8 条回复
-
-
-
-
<div class="row buttons"> <?php echo CHtml::ajaxButton($model->isNewRecord ? '新增记录' : '保存修改',array('records/create'),array ('type'=>'POST','success'=>'function(html){if(html=="success"){alert("成功 ^0^ ")}else{alert("失败 T.T ")}}' )); ?> </div> public function actionCreate() { $model=new Records; // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if(isset($_POST['Records'])) { $model->attributes=$_POST['Records']; if($model->save()){ echo 'success'; }else{ echo 'fail'; } Yii::app()->end(); //$this->redirect(array('create')); //echo '<script>alert("123");</script>'; } $this->render('create',array( 'model'=>$model,)); }
-
davidhhuan 回复于 2012-01-06 10:35 举报
- ajax 提交
- 数据提交在controller里面对处理完了,重新assign到你的视图,就好像你使用了 CLoginForm 之类的 model,详细代码请留意 blog demo
-
-
我的ajax提交出问题了,报HTTP 500可能是什么原因啊,说是Jquery.js 7829行有问题,该行的内容为
7826 // Do send the request
7827 // This may raise an exception which is actually
7828 // handled in jQuery.ajax (so no try/catch here)
7829 xhr.send( ( s.hasContent && s.data ) || null );
难道是Ajax中的data出问题了?'ajax'=>array( 'url'=>Yii::app()->createUrl('Issue/issue/dynamicProjectNumber'), 'data'=>array( 'machine_sn' => 'js:this.value'), 'update'=>'#Issue_project_number', ),
-
webyjh
注册时间:2011-12-12
最后登录:2016-10-06
在线时长:1小时45分
最后登录:2016-10-06
在线时长:1小时45分
- 粉丝2
- 金钱1090
- 威望0
- 积分1100