How can I change the values of the AjaxOptions depending on the submit value of the pressed button.
In View:
@using (Ajax.BeginForm("function_name", "Controller",
new AjaxOptions
{
HttpMethod = "POST",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "resultsLoad",
OnBegin = "function_onBegin",
OnFailure = "function_onFailure",
OnSuccess = "function_onSuccess",
OnComplete = "function_onComplete"
})) {
<button type="submit" id="btn_1" value="submit1" name="submit"></button>
<button type="submit" id="btn_2" value="submit2" name="submit"></button>
}
In Controller:
[HttpPost]
public ActionResult function_name(IndexViewModel model, string submit)
{
enter code...
return PartialView();
}
When I post by pressing any of the buttons, I need to change the AjaxOptions values before returning the new PartialView.