Ajax BeginForm posting to an action that returns json, IE tries to download it
- by ryanrdl
Here is the code I am using to setup the form:
<% using (Ajax.BeginForm("SaveCroppedPhoto", new { Id = Model.memberId.GetValueOrDefault() }, new AjaxOptions
{
OnBegin = "ProfileOnBegin",
OnComplete = "ProfileOnComplete",
OnFailure = "ProfileOnFailure",
OnSuccess = "ProfileOnSuccess"
}, new { id = "cropPhotoForm" })) {%>
My action result returns a json result as follow:
return Json(new { success });
In IE8 when the action returns, it tries to download the result. The content type coming back is application/json. Anyone have any idea how to stop IE from trying to download the result?