Skip to content

Instantly share code, notes, and snippets.

@pzread
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pzread/9c9b756f0a29683f78a0 to your computer and use it in GitHub Desktop.
Save pzread/9c9b756f0a29683f78a0 to your computer and use it in GitHub Desktop.
$.ajax({
'url':'/judge/api/' + api_key + '/add_pkg',
'type':'POST',
'data':pkg,
'cache':false,
'processData':false,
'contentType':false,
'xhr':function(){
var xhr = new XMLHttpRequest();
xhr.upload.addEventListener('progress',function(e){
var prog = Math.min(100,e.loaded / pkg.size * 100);
j_bar.css('width',prog + '%');
});
return xhr;
},
'success':function(res){
j_result_spin.hide();
j_result.text(JSON.stringify(res,null,' '));
j_result.show();
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment