【发布时间】:2015-10-13 18:06:07
【问题描述】:
我正在使用 XMLHttpRequest 方法从服务器获取单个图像的 url 以下载、保存然后从 android 本地存储中检索它,并且我已成功使其适用于单个图像 url;现在我一直在想办法使用相同的方法从服务器下载多个图像。任何人都可以告诉我一两个方法吗?
提前致谢!!!
这里是我用来下载单个图像的代码
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = "blob";
console.log(xhr);
xhr.onload = function (e) {
console.log(e);
if (xhr.readyState == 4) {
console.log(xhr.response);
// if (success) success(xhr.response);
saveFile(xhr.response, 'images');
}
};
xhr.send();
【问题讨论】:
标签: javascript android angularjs xmlhttprequest