i tried to pop up a view using modal. i couldnt manage what am i doing wrong?
here is my view
<?php use yii\helpers\Html;
$this->registerJs(
//~ 'jQuery.noConflict();
'$("document").ready(function($){
$("body").on("click", ".seat", function(e) {
var url = $(this).attr("href");
$("#seatModal").find(".modal-body").load( url );
$("#seatModal").modal({ backdrop: "static", keyboard: true });
e.preventDefault();
return false;
});
});'
);
[size=2]<?php [/size]
[size=2]echo Html::a(Yii::t('app', ' {modelClass}', [[/size]
'modelClass' => 'Select City',
]), ['site/city'], ['class' => 'btn btn-link seat']
[size=2]); [/size]
?>
<div class="modal fade " id="seatModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Seat Selection</h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
Controller
public function actionCity()
{
//~ $this->layout= "null";
$model = new Locations();
return $this->renderAjax('select_city', [
'model' => $model,
]);
}
and this is the view that i want to popup
<?php $form = ActiveForm::begin(); ?>
<div class="col-md-6">
<?php
$items = ArrayHelper::map(Locations::find()->all(), 'id', 'name');
echo $form->field($model, 'name')->dropDownList($items)
?>
</div>
<div class="form-group">
<?php echo Html::a(Yii::t('app', ' {modelClass}', [
'modelClass' => 'OK',
]), ['site/choose'], ['class' => 'btn btn-success ']
); ?>
</div>
<?php ActiveForm::end(); ?>
</div>
thanks