ajaxinternet-explorermodel-view-controllercompatibility

ajaxSubmit not working in IE jQuery Form plugin


I am using jQuery form plugin to upload images in my MVC project.

For some reason, the Code in IE no longer working (worked before): I can tell the submit is successful, image is successfully uploaded, and recoded in database, however the response seems somehow corrupted in IE.

function showResponse(responseText, statusText, xhr, $form) {
            $("#loading").hide();
            AddImage(responseText.ImageId);
            buildArray();
        }

I tested on Firefox, Chrome, Safari, it all working fine, however when I use it in IE.

I got this error:

Message: 'ImageId' is null or not an object

Anyone have had any similar problem before?


Solution

  • The problem solved by changing the content type from "text/plain" to "text/html":

    return Json(newImage, "text/html", Encoding.Unicode, JsonRequestBehavior.AllowGet);