title: How to close boostrap Dialog in yii2?
body: <p>I'm trying to do this:</p>
  
  <ol>
  <li><p>Open a bootstrap dialog with a button, through a URL. Action of the Url in controller  is <code>"myController/updateDialog"</code>.</p></li>
  <li><p>By open dialog, this loads a page (<code>myController/updateDialog</code>) with a form to fill data (form has a button to submit).</p></li>
  <li><p>If I submit the form by clicking the button, in my controller I tried close the dialog and refresh some things in the original page, this I do with JS.  But it doesn't work. I always get the window navigator in the blank with the new URL; I expect to keep the original page where the dialog was invoked, to see the changes, same way that does <code>CJUIDIALOG</code> in <code>Yii 1.x</code>. </p></li>
  </ol>
  
  <p>The controller's code is:</p>
  
  <pre><code>public function actionUpdatedialog($id)
  { 
     $model = $this-&gt;findModel($id);
      if ($model-&gt;load(Yii::$app-&gt;request-&gt;post() &amp;&amp;  $model-&gt;save() )) {           
         $this-&gt;view-&gt;registerJs("window.close(); window.opener.fn.yiiGridView.update('books-heads'); return false;",
              $this-&gt;view::POS_HEAD);//try close and finally 
       die(); //finally 
  
      } 
      return $this-&gt;render('update', [
          'model' =&gt; $model,
      ]);
  }
  </code></pre>
  
  <p>I tried, with : </p>
  
  <p><code>"window.close();"</code>  and </p>
  
  <p><code>"$(#Mymodal).modal('hide');"</code>  and others, but could not sort it out.</p>