title: How to redirect to another page after submitting an alert in ASP MVC
body: <p>I am developing an ASP MVC 5 web application. </p>
  
  <p>In one of my page, I am trying to redirect the user to the home page after sending mail and this will be after showing a SweetAlert Dialog.</p>
  
  <p>Indeed, the process must be in this order:</p>
  
  <blockquote>
    <ol>
    <li>Click on Button Confirm</li>
    <li>Showing alert dialog which contains Ok button</li>
    <li>Click on Ok in this dialog</li>
    <li>Close the alert dialog</li>
    <li>Redirecting the user to Home page</li>
    </ol>
  </blockquote>
  
  <p>The problem is that the process in working for me in this following wrong way:</p>
  
  <blockquote>
    <ol>
    <li>Click on Button Confirm</li>
    <li>Redirecting the user to Home page</li>
    </ol>
  </blockquote>
  
  <p>This is my view :  </p>
  
  <pre><code>&lt;input type="submit" value="Confirm" style="margin-left:-270px;" onclick="SendEmail()"&gt;
  </code></pre>
  
  
  
  <pre><code>&lt;script&gt;
      var SendEmail = function () {
  
          jQuery.ajax({
              type: "POST",
              url: "/Bestellung/SendMailToUser",
  
  
              success: function (data) {
  
                  swal("Good job!", "Your order has been confirmed with success :)", "success");
                  window.location = "/Home/Index";
              }
  
          })
      }
  
  &lt;/script&gt;
  </code></pre>