How to make progress bar with jQuery and PHP while waiting server process?

后端 未结 2 1980
予麋鹿
予麋鹿 2021-01-18 23:53

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

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-19 00:30

    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.

提交回复
热议问题