Skip to content

Instantly share code, notes, and snippets.

@dotspencer
Created June 8, 2016 07:14
Show Gist options
  • Save dotspencer/238d9c4a45fccfd4c4acc6c67b577b65 to your computer and use it in GitHub Desktop.
Save dotspencer/238d9c4a45fccfd4c4acc6c67b577b65 to your computer and use it in GitHub Desktop.
ajax request for loading bar
$.ajax({
xhr: function()
{
var xhr = new window.XMLHttpRequest();
//Download progress
xhr.addEventListener("progress", function(evt){
var percentComplete = evt.loaded / evt.total;
//Do something with download progress
console.log("down", percentComplete);
$('progress').attr("value", percentComplete * 100)
}, false);
return xhr;
},
url: "/staff",
success: function(data){
console.log(arguments);
$('.staff').html(data);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment