【发布时间】:2015-12-07 11:24:48
【问题描述】:
我从服务器获取这些数据作为 JSON 响应:
{
"success": true,
"status": "success",
"path": "http:\/\/www.images.site.com\/profile\/large\/",
"smallpath": "http:\/\/www.images.site.com\/profile\/small\/",
"smpath": "http:\/\/www.images.site.com\/profile\/sm\/"
}
如何在 jQuery 成功时访问它?我试过这个:
$(document).ready(function () {
$("#img").dropzone({
paramName: "file",
maxFiles: 1,
url: 'http://images.site.com/aac.php',
init: function () {
this.on("success", function (file, dd) {
console.log("log " + dd.length);
console.log("log " + dd.success);
console.log("sd" + dd.path);
}).fail(function () {
alert("error");
});
}
});
我收到一个错误:
记录来自服务器的无效 JSON 响应
我正在使用 dropzone.js 进行文件上传
【问题讨论】:
-
您可以添加用于从服务器获取数据的代码吗?主要是
this引用的内容 -
请再次查看问题。括号可能在这里错误,它已正确关闭
标签: jquery json dropzone.js