Hi I am pretty new to web development and am stuck on a specific scenario.
I have a Map controller with 2 methods:
public ActionResult Map1(double easting, double northing)
public ActionResult Map2(double easting, double northing)
When called they both navigate their corresponding view with whatever model is required:
return View(model);
I then have some javascript which needs to call the corresponding controller method depending on the action passed through.
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.
Currently the only way I have got it to work is by this:
window.location.href = '/Map/' + actionVal + '?easting=' + easting + '&northing=' + northing;
But with using this I cannot set the methods as POST.
Does anyone have a better idea of how I should do this?