Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.ajax({
- xhr: function() {
- var xhr = new window.XMLHttpRequest();
- xhr.upload.addEventListener("progress", function(evt) {
- if (evt.lengthComputable) {
- var percentComplete = evt.loaded / evt.total;
- //Do something with upload progress here
- }
- }, false);
- xhr.addEventListener("progress", function(evt) {
- if (evt.lengthComputable) {
- var percentComplete = evt.loaded / evt.total;
- //Do something with download progress
- }
- }, false);
- return xhr;
- },
- type: 'POST',
- url: "/",
- data: {},
- success: function(data){
- //Do something on success
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement