[HttpPost] public JsonResult Ajax(string AJAXParameter1) { List<string> data = new List<string>(); data.Add("AJAXParameter1=" + AJAXParameter1); return Json(new { data, result = "OK" }); }
If parameter AJAXParameter1 recieves value as passport i want to display view that contains fileds related to passport. If it recieves value as pan i want to render some different view that allow us to add pan card related details. For pan and passport i have models. Based on Id i want to generate view.
[HttpPost] public ActionResult Ajax(string AJAXParameter1) { if (AJAXParameter1 == "passport") { // if you want to return a model too then add it as a second parameter return View("~/Views/MyController/Password.cshtml"); } else { return View("~/Views/MyController/SomeOtherView.cshtml"); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)