Hi Jak,
Use OnSuccess in jsonoption of Ajax.BeginForm() as:
<div>
@using (Ajax.BeginForm("AjaxSubmit2", "Default1", new AjaxOptions { LoadingElementId = "AjaxSubmitLoadingID", OnSuccess="GetJsonResult()", HttpMethod = "Post" }))
{
<div id="AjaxSubmitLoadingID"></div>
<input name="test" />
<button>Ajax submit</button>
}
<script type="text/javascript">
function GetJsonResult(JSON) {
//JSON
}
</script>
</div>
And the action in the controller return json result as:
[HttpPost]
public ActionResult AjaxSubmit2(AjaxlModel model)
{
return Json("simple json");
}
Posted On:
22-Sep-2015 00:18