jQuery帖子正在等待中

时间:2013-09-26 00:21:26

标签: javascript jquery ajax node.js

当用户在我的一个页面中的“放置区域”上删除多个图像时,我使用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

0 个答案:

没有答案