Last active
June 8, 2016 06:54
-
-
Save dotspencer/dae54e853e63f14a9924c2f4dda64a93 to your computer and use it in GitHub Desktop.
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
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> | |
<div class="progress"></div> | |
<script> | |
console.log("hi"); | |
$.ajax({ | |
success: function(data){ | |
console.log(data); | |
// Do stuff with the returned file | |
}, | |
type: 'post', | |
url: 'http://spencerlarry.com', | |
xhr: function(){ | |
// get the native XmlHttpRequest object | |
var xhr = $.ajaxSettings.xhr() ; | |
// set the onprogress event handler | |
xhr.upload.onprogress = function(evt){ console.log('progress', evt.loaded/evt.total*100) } ; | |
// set the onload event handler | |
xhr.upload.onload = function(){ console.log('DONE!') } ; | |
// return the customized object | |
return xhr ; | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment