我正在使用 Blueimp jQuery 文件上传插件,我的配置是:
$('#fileupload').fileupload({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: 'assets/plugins/jquery-file-upload/server/php/',
done: function (e, data) {
//some code
}
});
当一个文件上传完成后,我需要在 done:
事件的列表中隐藏该文件,但我无法在队列列表中获取该文件的索引。
有什么想法吗?
最佳答案
找到了有关我的问题的解决方案。
jQuery Fileupload
返回 done
事件的数据,其中包含每个上传线程的 context
参数,该参数与 DOM 元素相关,可以使用对于任何操作,例如隐藏在我的箱子中:
$('#fileupload').fileupload({
// Uncomment the following to send cross-domain cookies:
//xhrFields: {withCredentials: true},
url: 'assets/plugins/jquery-file-upload/server/php/',
done: function(e, data) {
//hide completed upload element in queue
$(data.context['0']).fadeOut(700);
//here isoutput of uploaded objects
console.log(data.result);
}
});
关于javascript - Blueimp jQuery 文件上传 - 上传完成响应后隐藏队列中的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24727116/