dqst96444 2013-09-11 08:08
浏览 52
已采纳

如何在等待服务器进程的同时使用jQuery和PHP创建进度条?

It used to be easy to find solutions of my problem when Google gives many accurate results that point to Stackoverflow. But, I didn't found one for this problem. If any of you have suggestion where should I go for this problem, please give me link to the answer.

The case is I want to make searching index from database. The indexing process is triggered by jQuery.getJSON. It takes minutes to finish so I want to make progress bar to show that indexing process. I know how to make common ajax request using .getJSON as client side and PHP as server side, but It seems difficult for me to imagine how to make such progress bar.

Is there any body that can explain to me how to do that?

  • 写回答

2条回答 默认 最新

  • dpd2349 2013-09-11 08:12
    关注
    1. check Jquery Progress bar UI : http://jqueryui.com/progressbar/
    2. use .getJSON or an ajax call every 10 seconds to call the server and check the progress
    3. after you get the server progress update the UI

    Explaining Step2

    step 2 is generally based on your application flow, lets say for example i'm inserting 100,000 records in MYSQL, i would create another service that will check the rows count and the result were 30,000 records for example, that means the progress now is 30%, so if i call this service every 10 seconds i would get the current progress.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog