简体   繁体   English

ajax PHP进度栏

[英]ajax PHP progress bar

I have a code that gets some data and send it to a php page that makes the process and finally shows the result of this process without reload the page: 我有一个获取一些数据并将其发送到php页面的代码,该页面使该过程最终显示了该过程的结果,而无需重新加载该页面:

So, I hace this code that calls process.php file. 因此,我使用了此代码来调用process.php文件。

    $(document).ready(function(){
    $("#btEnviar").click(function (){
      var datos = $("#formulario").serialize();
    $.ajax({
    type: "POST", 
      url: "process.php",
     data: datos, 
     contentType: "application/x-www-form-urlencoded", 
    beforeSend: function() {
    $("#status").html("Enviando...."); 
     },
   dataType: "html",
      success: function(datos){ 
    if(datos == 1){ 
     $("#status").html("Script procesado satisfactoriamente"); 
    }else if(datos == 0){ 
     $("#status").html("Error al procesar script"); 
    }
    }
    });
    });
    });

It is possible to make a progress bar of process.php ? 可以制作一个process.php进度条吗?

Thanks in advance for your help. 在此先感谢您的帮助。

Have you looked at http://php.net/manual/en/session.upload-progress.php 您是否看过http://php.net/manual/en/session.upload-progress.php

Note, it doesn't work in fastCGI mode 请注意,它在fastCGI模式下不起作用

You may use some ready-made solution like Reload Progress Bar . 您可以使用一些现成的解决方案,例如Reload Progress Bar However, check this post first File upload progress bar with jQuery . 但是,请首先使用jQuery检查此帖子的文件上传进度栏 I hope it helps. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM