I am using the jQuery form plugin in my MVC project to upload the image.
Image upload works correctly in Chrome and Firefox, though it comes to IE 8.
Instead of returning Jason data instead of backing up Jason data which is later consumed by post-remote callback, in IE 8 it gives a txt file and asks you whether you want to download .
It did not know where I was wrong,
Thanks in advance.
P> The code is placed in a separate JS file: upload.js
(function ($ } {ImageUploader = function (o) {var option = {success: ShowResponse, // post-submit callback url: "/ Image / ImageUpload", // Override for the 'action' attribute type of form: "post", / / 'Mill' or 'Post', Override for the 'Method' attribute data type: 'Json', // 'xml', 'script', or 'json' (expected server response type) clearForm: true // After the successful form, clear all form fields; o.ajaxForm (options); $ ("input #file"). (Function () {o.submit ();}); // Post-submitting callback function showResponse (response text, status text, excerpt, $ form) {....}};}) (jQuery); On page view
:
$ (document) .ready (function () {ImageUploader ($ ("# ajaxUploadForm"));};
After a painful digging through the internet well I finally get the solution To share this:
The jQuery form plug-in is not a problem at all
The problem is buggy. IE 8 could not handle enough Json callback.
Solution: Specify the content type as "App / JSON" to "Text / plain" from "application / json" MVC JsonResult
Return Jason (new image, "Text / plain", Jasonoffest Behavior, Elove Gate);
Comments
Post a Comment