Skip to content

Instantly share code, notes, and snippets.

@pzread pzread/upload.js
Last active Aug 29, 2015

Embed
What would you like to do?
$.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
You can’t perform that action at this time.