I am trying to call a controller via ajax without to much luck. I have create this in my view
<input type="submit" id="preview-email" value="Preview Email" /> <script type="text/javascript"> $("#preview-email").click(function () { var p = { "email": "1223" }; $.ajax({ url: '/BusinessController/PreviewEmail', type: "POST", data: p, dataType: "json", contentType: "application/json; charset=utf-8", success: function (data) { alert(data); }, error: function () { alert("error"); } }); }); </script> My controller
[HttpPost] public ActionResult PreviewEmail(string email) { // string d = ViewData["editor"].ToString(); string e = System.Web.HttpUtility.HtmlDecode(email); EmailModel model = new EmailModel() { EmailBody = e }; return PartialView("_PreviewEmail", model); } Turning on fiddler is telling me that its a 500 error. What have I done wrong? I've placed a breakpoint on my controller however it doesnt get that far