Feel like I'm missing something simple here - When I submit this form it takes me to a white page with my encoded JSON model, rather than staying on the page I was on.
Form in a partial view, loaded on every page:
@using (Ajax.BeginForm("Inquiry", "Home", new AjaxOptions { HttpMethod = "POST", OnSuccess = "success" }))
And my actions:
public ActionResult Inquiry()
{
return PartialView("_Inquiry",new Inquiry());
}
[HttpPost]
public JsonResult Inquiry(Inquiry model)
{
if (ModelState.IsValid)
{
db.Inquiries.Add(model);
db.SaveChanges();
}
return Json(model);
}