title: MVC How to call controller post method
body: <p>Hi I am pretty new to web development and am stuck on a specific scenario.</p>
  
  <p>I have a Map controller with 2 methods:</p>
  
  <pre><code>public ActionResult Map1(double easting, double northing)
  public ActionResult Map2(double easting, double northing)
  </code></pre>
  
  <p>When called they both navigate their corresponding view with whatever model is required:</p>
  
  <pre><code>return View(model);
  </code></pre>
  
  <p>I then have some javascript which needs to call the corresponding controller method depending on the action passed through.</p>
  
  <p>I want to mark the controller methods as [HttpPost], but when I do this then use an ajax request in the javascript the call to the View gets swallowed and the page is not redirected.</p>
  
  <p>Currently the only way I have got it to work is by this:</p>
  
  <pre><code>window.location.href = '/Map/' + actionVal + '?easting=' + easting + '&amp;northing=' + northing;
  </code></pre>
  
  <p>But with using this I cannot set the methods as POST.</p>
  
  <p>Does anyone have a better idea of how I should do this?</p>