dspym82000 2011-08-10 03:31 采纳率: 100%
浏览 36
已采纳

JavaScript / jQuery检查在尝试加载/打开之前是否可以读取文件

I have a PHP file that writes a significant amount of data to a "dump" file, then I am using Jquery to $('#element').load() that data from my user interface page. The problem is that I am creating this dump file on the fly and as more and more of the dump file contents are added, every few seconds my Jquery loads that data again. This works fine most of the time. The problem arises when the read happens, while the file is being written to. This halts my PHP script. I check in PHP with is is_writable() to make sure the file is available but is there a "is_readable()" type of function for JavaScript/Jquery? I know that I could create an "intermediate" PHP file to check, but that would require a significant amount of change to do, is there an easy way to check in JavaScript?

  • 写回答

2条回答 默认 最新

  • doufei6456 2011-08-26 01:00
    关注

    Ending up having to use an intermediary php file that waits for the dump file to become available before trying to read from it, then just echos the contents

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

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度