render('remarks',['model'=>$remarkModel]);"; then create a template pop-up window file, the code is "use yii\help"."/> render('remarks',['model'=>$remarkModel]);"; then create a template pop-up window file, the code is "use yii\help".">
Home >PHP Framework >YII >How to make a pop-up window in Yii
YII2 Make a pop-up page and modify the content of the pop-up window
Recommendation: "yii tutorial"
template list. The source code of php is as follows
<?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>
Template pop-up 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>
Controller 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]); } }
The above is the detailed content of How to make a pop-up window in Yii. For more information, please follow other related articles on the PHP Chinese website!