Search code examples
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 successful 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 error:

Message: 'ImageId' is null or not an object

Anyone have had any similar problem before?

Thanks in advance!


Solution

  • Well the problem solved by changing the content type from "text/plain" to "text/html", that's it.

    OMFG, Internet Explore!

    Code I have changed:

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

    hope that would help someone else as well.