我一生都无法弄清楚为什么下面的 Plupload 返回的响应对象无法解析。
我从我的 ASP.NET MVC 控制器返回一个 JsonResult,如下所示:
public JsonResult Upload()
{
// code to process the upload
return Json(new { success = true, data = "Some response data" });
}
我在视图中阅读它如下:
uploader.bind("FileUploaded", function (up, file, response) {
response = $.parseJSON(response);
alert("I managed to parse it!");
if (response.success) {
// do something with the response data
} else {
// tell the user there was an error
}
});
它永远不会发出警报“我设法解析它!”