dougou7008 2012-04-23 02:24
浏览 20

自动刷新php循环计数器的ajax显示

I'm been around php for a few months, but am new to ajax. At this point, I've been able to use ajax to launch my php script and update my page results without reload and i've been able to auto refresh another script to run it more than once.

I have large recordsets that can take 8 - 10 - 12 minutes to process depending on what's being done. I'd like to be able to auto refresh an ajax "progress" display on my page that says "Processing record x of y" where x is the loop counter and y is the number of records in my recordset and both are php variables.

I've searched, but don't seem to find anything like this. Can anyone help point me in the right direction?

Thanks

  • 写回答

1条回答 默认 最新

  • dow58115 2012-04-23 02:31
    关注

    What you can do is while the first ajax is still in progress and php script runs update either a database record or a session variable with the progress. Then have periodic ajax requests ( other ajax requests apart from the main ajax request) that grab the progress from either the database record or session variable and send the progress back to the client, this progress can then be displayed. Keep doing this until the main ajax request has finished.

    评论

报告相同问题?

悬赏问题

  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan