views:

54

answers:

1

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?

Some additional info: I just noticed in fiddler that when I am saving, two requests are made to the action. Trying to figure that out now. I am guessing that is the cause of the problem.

A: 

I was trying to call $(frm).submit() and so it was causing the ajax post plus a regular post. That is why it was trying to download the json. My bad.

I solved this by appending a hidden submit button to the form and firing the click event in javascript.

ryanrdl