简体   繁体   中英

Jquery.form (3.51.0-2014.06.20) fileupload not working in IE9 (sharepoint application)

Ok, before I start let me say I did look at almost all answers in SO and elsewhere reg. jq form upload issues and confident that this issue is different.

What basically happens is the file upload goes fine and a response is returned in application/json format with a ID from the upload controller. Initially in IE the response was prompting for a download and to solve that I changed the content type to text/json (text/html,text/xml). Now it does not prompt for download anymore but when I try to access the response looking for the return values it comes up empty. The code looks like this and xhr.responseText is empty.

 $('#upload-file-data-form').ajaxSubmit({
                    xhrFields: { withCredentials: true },
                    url: url,
                    dataType: "json",
                    data: { DataItems : "some data" },
                    complete: function (xhr) {
                        var json = xhr.responseText;
                        var data = $.parseJSON(json);
                        onDone(data.d);
                    },
                    errors: function () {
                        onFail();
                    }
                });

Fiddler extract of the returned JSON.

在此处输入图片说明

The application is hosted in SP online and the the upload happens to a web api endpoint in azure. Since this works fine in chrome and IE11 I'm assuming this is a CORS issue in IE9. I have been messing with this more than 2 days now and I'd buy a beer (no joke! :) ) for anyone who can shed some light on this.

Cheers!

It might be, because you have a Syntax-Error in your Code:

data: { "some data" }

Choose between (submit an Object)

data: { name: "firstname"}

or an Array

data: ["some data"]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM