芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/bit-alphas-ltd.com/user/project/vendor/update/install.js
$('#the_button').click(function () { $('#installingModal').modal({ backdrop: 'static', keyboard: false }); $('#installingModal').modal('show'); //var file_data = $('#installer').prop('files')[0]; //var form_data = new FormData($('#installer')); //form_data.append('file', file_data); var formt = $('form')[0]; // You need to use standard javascript object here var formData = new FormData(formt); $.ajax({ type: "POST", url: "run_install.php", cache: false, contentType: false, processData: false, data: formData, async: true, xhr: function () { var xhr = new window.XMLHttpRequest(); //Upload Progress xhr.upload.addEventListener("progress", function (evt) { var percentComplete = ""; if (evt.lengthComputable) { percentComplete = (evt.loaded / evt.total); }else{ percentComplete = 1; } move(); function move() { var width = 1; var id = setInterval(frame, percentComplete); function frame() { if (width >= 100) { clearInterval(id); } else { width++; $('#insprogress').find('.progress-bar').css({ "width": width + "%" }); } } } }, false ); //Download progress xhr.addEventListener("progress", function (evt){ var percentComplete = ""; if (evt.lengthComputable) { percentComplete = (evt.loaded / evt.total); }else{ percentComplete = 1; } move(); function move() { var width = 1; var id = setInterval(frame, percentComplete); function frame() { if (width >= 100) { clearInterval(id); } else { width++; $('#insprogress').find('.progress-bar').css({ "width": width + "%" }); } } } }, false ); return xhr; }, success: function(data) { //alert("Form Submitted: " + msg); setTimeout(function(){ if($.trim(data) === 'success'){ $('#info_head').html('
Installation Success !!'); $('#info_body').html('Your Installation is completed success fully.
Please visit your website now.
Thank you'); $('#info_button').html('
Close & Run Website
'); //$('#loading').hide(); $('#installingModal').modal('hide'); $('#myModal').modal({ backdrop: 'static', keyboard: false }); $('#myModal').modal('show'); }else { $('#info_head').html('
Installation Failed !!'); $('#info_body').html(data); $('#info_button').html('
Close & Try Again
'); //$('#loading').hide(); $('#installingModal').modal('hide'); $('#myModal').modal({ backdrop: 'static', keyboard: false }); $('#myModal').modal('show'); } }, 1000); } }) });