当用户在我的一个页面的“放置区”上放置多个图像时,我使用 jQuery 循环遍历 evt.originalEvent.dataTransfer.files 中的文件,并使用 jQuery 发布调用上传每个图像。直到几天前,它都运行良好,但此后停止运行。现在只有一两个 post 调用成功,其余的最终陷入“待定”状态。我正在使用的 jQuery 调用是:
$.ajax({
type: "POST",
url: url,
contentType: "application/json",
processData: false,
data: JSON.stringify(data),
dataType: 'json'
})
.done(function(dbResp, textStatus, jqXHR) {
if(obj.type == 'imageAttachment') {
return ctx.insertNewImage(dbResp);
}
ctx.insertNewFile(dbResp);
})
.fail(function(jqXHR, textStatus, error) {
var msg = 'Error(s) were encountered during file upload: ';
msg += jqXHR.status + " " + jqXHR.statusText;
notify(msg, 'error');
});
我的服务器 (nodejs) 发送一个 200 响应,其中包含一个 JSON 对象,其中包含有关附件文档的信息。我可以在 Chrome 的浏览器控制台中看到响应,所以我知道它正在被接收,但待处理的 ajax 发布请求仍然待处理。知道我要去哪里错了吗?这是回应:
console.log('arguments: ', arguments);
0: Object
_id: "e4f4b9e80a9866c5efc728d00a8568ba"
_rev: "1-5dce4437e45dc030ace54f25a75de34a"
1: "success"
2: Object