yii\bootstrap\Modal::begin([
'id' => 'myModal',
'size' => 'modal-lg',
'header' => '',
'clientOptions' => ['backdrop' => 'static', 'keyboard' => true]
]);
yii\bootstrap\Modal::end();
Html::a(Yii::t('app', ' {modelClass}', [
'modelClass' => 'Add More Skill',
]), ['my/newskill'], ['class' => 'btn btn-success',
'data-toggle'=>"modal",
'data-target'=>"#myModal",
'data-title'=>"My Skill",]);
$this->registerJs("
$('#myModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget)
var modal = $(this)
var title = button.data('title')
var href = button.attr('href')
modal.find('.modal-title').html(title)
modal.find('.modal-body').html('')
$.post(href)
.done(function( data ) {
modal.find('.modal-body').html(data)
});
})
");
In controller
return $this->renderAjax('newskill', [
'model' => $model,
'services' => $services,
'subservices' => $subservices,
'basicinfo' => $basicinfo,
]);