title: Redirect to another view using Ajax in Javascript
body: <p>I am new to Javascript. I need help in the following scenario:</p>
  
  <p>I have 2 dropdowns in my view, and a Anchor(a) element. On click of this anchor element, I want to redirect to another view(basically have to call another action function), but I need to pass the current values which are being selected in those 2 drop downs. In short, I need to call another action function and pass the 2 current values selected in drop downs with it.</p>
  
  <p>I have written the following Ajax code, however it is always going to the error part:</p>
  
  <pre><code>$.ajax({
      type: 'GET',
      url: Url.Action("ActionMethod", "MyController"),
      data: {
          param1: DD1Value,
          param2: DD2Value,
          param3: xyz
      },
      success: function (data) {
          window.location.href = data.redirecturl;
      },
      error: function () {
          alert('error happened');
      }
  }); 
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>[HttpGet]
  public ActionResult ActionMethod(DateTime param1, DateTime param2, string param3)
  {
  //Do some work
  //Return View
  }
  </code></pre>
  
  <p>Edit:
  I do understand the whole point of Ajax is to stay on the same page. I have tried using window.location.href too,:</p>
  
  <pre><code>window.location.href = "/MyController/ActionMethod?param1=" + DD1Value+ "&amp;param2=" + DD2Value+ "&amp;param3=" + "xyz"
  </code></pre>
  
  <p>however this is resulting a routing error. Route.config cannot be changed to accommodate this.</p>