我已撰写了一份MVC3号申请,其中我使用。 有效载荷。 当用户上载一个档案时,服务器将显示成功/失败以及可能出现错误信息的一个JSON物体上。 一些用户报告说,他们的浏览器要求他们采取行动,如下载档案(假冒/开放),而不是将JSON传到 j。
I m使用分发的上载器,而我的C#控制器将一名JSONResult如此返回。
return JSON(new { success = true }, "application/json");
或者如果情况有误
return JSON(new { success = false, error = exception.Message });
I have been unable to reproduce this, and have gotten reports from users of both IE9 and Chrome. Has anyone had this happen, and what did you do to solve it? Or where should I start troubleshooting?
EDIT:
The file uploader will run this on the onComplete
event:
function(id, filename, responseJson) {
if(responseJson.success != true) {
alert("An error occurred: " + responseJson.error);
return false;
}
return true;
}