PHP完全自学手册(珍藏版) 中文pdf扫描版下载
yii2 弹出层
Modal::begin();
echo $this->render('edit_post_form', ['model' => Post::findOne(my_post_id)]);
Modal::end();
echo $this->render('edit_post_form', ['model' => Post::findOne(my_post_id)]);
Modal::end();
<?= \yii\bootstrap\Modal::widget([
'id' => 'contact-modal',
'toggleButton' => [
'label' => 'Обратная связь',
'tag' => 'a',
'data-target' => '#contact-modal',
'href' => Url::toRoute(['/main/contact']),
],
'clientOptions' => false,
]); ?>
'id' => 'contact-modal',
'toggleButton' => [
'label' => 'Обратная связь',
'tag' => 'a',
'data-target' => '#contact-modal',
'href' => Url::toRoute(['/main/contact']),
],
'clientOptions' => false,
]); ?>
$model = new ContactForm();
return $this->renderAjax('contact', [
'model' => $model,
]);
return $this->renderAjax('contact', [
'model' => $model,
]);
$js = <<<JS
jQuery('#contact-form').on('beforeSubmit', function(){
var form = jQuery(this);
jQuery.post(
form.attr("action"),
form.serialize()
)
.done(function(result) {
form.parent().replaceWith(result);
})
.fail(function() {
console.log("server error");
});
return false;
})
JS;
$this->registerJs($js);
jQuery('#contact-form').on('beforeSubmit', function(){
var form = jQuery(this);
jQuery.post(
form.attr("action"),
form.serialize()
)
.done(function(result) {
form.parent().replaceWith(result);
})
.fail(function() {
console.log("server error");
});
return false;
})
JS;
$this->registerJs($js);
转载请注明:谷谷点程序 » yii2 弹出层配置