Last active
June 1, 2016 19:55
-
-
Save smedstadc/ca0f3ded6b3f3c479c66b4793bdbab29 to your computer and use it in GitHub Desktop.
This file contains 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
```js | |
function handleUploadProgress(event) { | |
//... | |
} | |
function handleDownloadProress(event) { | |
//... | |
} | |
function prepareXHR() { | |
var xhr = new XMLHttpRequest(); | |
xhr.upload.addEventListener("progress", handleProgress, false); | |
xhr.addEventListener("progress", handleProgress, false); | |
return xhr; | |
}; | |
$.ajax({ | |
type: 'POST', | |
url: url, | |
data: data, | |
xhr: prepareXHR | |
}) | |
.done(handleDone) | |
.fail(handleFail) | |
.always(handleAlways); | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment