Last active
December 23, 2021 05:02
-
-
Save ridhotegar/8d796cbd3e280f349be598ecfe14e709 to your computer and use it in GitHub Desktop.
XMLHttpRequest download with JQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
url: "https://file-examples-com.github.io/uploads/2017/02/zip_10MB.zip", | |
cache: false, | |
xhr: function(){ | |
var xhr = new XMLHttpRequest(); | |
xhr.responseType= 'blob'; | |
xhr.onprogress = e => console.log(`${parseInt((e.loaded/e.total)*100)}%`) | |
return xhr; | |
}, | |
success: e => console.log('done') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment