Currently, I am successfully using the XMLHttpRequest method to obtain the URL of a single image from the server in order to download, save, and retrieve it from Android local storage. However, I have hit a roadblock when attempting to figure out how to download multiple images from the server using the same method. Can anyone offer me some guidance or solutions?
Thank you in advance for any assistance!
Below is the code that I am utilizing to download a single image:
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();