YII2 做彈窗頁面然後修改彈窗的內容
#推薦:《yii教學》
模板list. php的原始碼如下
<?php echo $this->render('remarks',['model'=>$remarkModel]); ?> <script type="text/javascript"> $(document).ready(function(){ $(".btn_edit").click(function(){ $.ajax({ url: "<?=yii::$app->request->baseUrl;?>/usersupervise/remarksuser", type: "get", data: {openid : 'o_-7SspsJjg4e8_dxtSznVGPJ9H4'}, success: function(data){ $('.showDiv_opaciy, .showDiv_edit').show(); } }); }); }); </script>
模板彈跳窗tanchuang.php
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; ?> <div class="showDiv_edit" style="display:none"> <div class="showDiv_title"><a href="javascript:void(0);" class="fr close"><img src="<?=yii::$app->request->baseUrl;?>/img/close.gif" width="17" height="16" alt="关闭" /></a> <h2>备注用户名</h2> </div> <div class="showDiv_con"> <span class="fr limit_num">2/30</span> <?php $form = ActiveForm::begin(); ?> <?= $form->field($model, 'remarkname',['inputOptions' => ['class' => 'inputText inputText_w230 inputText_remarkName']]) ?> <div class="btn_bar"> <?= Html::submitButton('确认', ['class' => 'btn btn_primary']) ?> <a href="javascript:void(0);" class="btn btn_default">取消</a> </div> <?php ActiveForm::end(); ?> </div> </div>
控制器user.php
public function actionRemarksuser() { if(yii::$app->request->isAjax){ if ($model->load(Yii::$app->request->post()) && $model->validate()) { print_r($openId['fromusername']);//打印不出来,用JS调用实现参数打印 } return $this->renderAjax('remarks',['model'=>$model]); } }
以上是yii如何做彈跳窗的詳細內容。更多資訊請關注PHP中文網其他相關文章!