
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中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号