gpt4 book ai didi

javascript - Jquery.form (3.51.0-2014.06.20) fileupload 在 IE9 中不起作用(sharepoint 应用程序)

转载 作者:行者123 更新时间:2023-11-28 08:00:28 25 4
gpt4 key购买 nike

好吧,在开始之前我要说的是,我确实查看了 SO 和其他地方的几乎所有答案。 jq表单上传问题并确信这个问题是不同的。

基本上发生的事情是文件上传顺利,并且响应以 application/json 格式返回,并带有来自上传 Controller 的 ID。最初在 IE 中,响应提示下载,为了解决这个问题,我将内容类型更改为 text/json(text/html、text/xml)。现在它不再提示下载,但是当我尝试访问响应以查找返回值时,它显示为空。代码如下所示,xhr.responseText 为空。

 $('#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 提取返回的 JSON。

enter image description here

该应用程序在线托管在 SP 中,上传发生在 azure 中的 Web API 端点。由于这在 chrome 和 IE11 中运行良好,我假设这是 IE9 中的 CORS 问题。我已经搞乱这个问题超过两天了,我会为任何能解释这一点的人买一瓶啤酒(不是开玩笑!:))。

干杯!

最佳答案

可能是这样,因为您的代码中有语法错误:

data: { "some data" }

选择(提交对象)

data: { name: "firstname"}

或数组

data: ["some data"]

关于javascript - Jquery.form (3.51.0-2014.06.20) fileupload 在 IE9 中不起作用(sharepoint 应用程序),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25480602/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com