function form_submit (){ new AjaxUpload(#upload, { action: upload.php, name: file, data: { APC_UPLOAD_PROGRESS:$("#progress_key").val() }, autoSubmit: true, onSubmit: function(file, extension){ $(#progressouter).css(display, block); progress(); }, onComplete: function(file, response){ $("#showInfo").html(response); } }); } function progress (){ $.ajax({ type: "GET", url: "progress.php?progress_key="+$("#progress_key").val(), dataType: "json", cache:false, success: function(data){ if(data == 0) { var precent = 0; } else { for (i in data) { if (i == "current") { var json_current = parseInt(data[i]); } if (i == "total") { var json_total = parseInt(data[i]); } } var precent = parseInt(json_current/json_total * 100); $("#progressinner").css("width",precent+"%"); $("#showNum").html(precent+"%"); $("#showInfo").html("ok"); } if ( precent < 100) { setTimeout("progress()", 100); } } }); }