Home > PHP Framework > YII > body text

How to make a pop-up window in Yii

藏色散人
Release: 2020-02-01 14:41:37
Original
2676 people have browsed it

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(&#39;remarks&#39;,[&#39;model&#39;=>$remarkModel]);
?>
<script type="text/javascript">
    $(document).ready(function(){
        $(".btn_edit").click(function(){
            $.ajax({
                url: "<?=yii::$app->request->baseUrl;?>/usersupervise/remarksuser",
                type: "get",
                data: {openid : &#39;o_-7SspsJjg4e8_dxtSznVGPJ9H4&#39;},
                success: function(data){
                    $(&#39;.showDiv_opaciy, .showDiv_edit&#39;).show();
                }
            });
        });
    });
</script>
Copy after login

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, &#39;remarkname&#39;,[&#39;inputOptions&#39; => [&#39;class&#39; => &#39;inputText inputText_w230 inputText_remarkName&#39;]]) ?>
        <div class="btn_bar">
            <?= Html::submitButton(&#39;确认&#39;, [&#39;class&#39; => &#39;btn btn_primary&#39;]) ?>
            <a href="javascript:void(0);" class="btn btn_default">取消</a>
        </div>
        <?php ActiveForm::end(); ?>
    </div>
</div>
Copy after login

Controller user.php

public function actionRemarksuser()
{
if(yii::$app->request->isAjax){
            if ($model->load(Yii::$app->request->post()) && $model->validate()) {
                print_r($openId[&#39;fromusername&#39;]);//打印不出来,用JS调用实现参数打印
            }
            return $this->renderAjax(&#39;remarks&#39;,[&#39;model&#39;=>$model]);
        }
}
Copy after login

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!

Related labels:
yii
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template