title: Spring MVC redirect: new page is opened in div
body: <p>Here is a problem I have encountered. </p>
  
  <p>I have jsp page which has a javascript openForm function. This function fetches data from server URL that relates to dialog.jsp and inserts that code into the body of my page. I.e. it looks like</p>
  
  <pre><code>function showDialog(url){
      $.get(url,function(data){
          $("body").append(data);
      })
  }
  </code></pre>
  
  <p>OK, but after user deals with that dialog I want to redirect him to some better place. I use return createRedirectModelAndView(URL_CONSTANT) in the controller, responsible for handling POST from that dialog.</p>
  
  <p>It works, but here is a problem: a new page (redirect target) is opened INSIDE that dialog div. So the parent page (on which user clicks showDialog) still exists and it looks like the redirect is redirecting user inside dialog. This effect can be cool in some situations, but not in mine. I want total redirect - close that page and open another. </p>
  
  <p>Where I went wrong?</p>