我可以使用 jQuery 加载数据而不让浏览器显示正在加载吗?
当我的网站第一次加载时,有一个数组填充了我使用 jQuery 获取的数据库中的信息(来自 google fusion 表)。信息量很大,因此根据事情的进展情况需要 3 到 10 秒的时间。不需要立即使用,页面的其余部分会加载。我的问题是浏览器图标仍在旋转,鼠标也在旋转(沙漏,无论如何)。这是有道理的,事情仍在加载,但我不希望用户感觉他们仍在等待,而实际上他们已经准备好了。有办法阻止这种行为吗?
When my site first loads, there's an array being filled with information from a database that I'm grabbing with jQuery (from google fusion tables). There's a lot of info, so it takes a good 3 - 10 seconds based on how things are going. It's not needed right away, and the rest of the page loads up. My issue is that the browser icon is still spinning and the mouse is spinning (hourglass, whatever). Makes sense, things are still loading, but I don't want the user to feel like they're still waiting when they're actually good to go. Is there a way to stop this behavior?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你应该将你的流程函数分成两部分:1)主流程(长查询...)和2)ajax函数来检查主流程的结果。 (你可以将结果存储在文件、数据库或内存缓存中...)
然后只需几毫秒即可返回服务器检查结果。用户将不会再看到加载光标。
I think you should split your process function to 2 parts: 1) the main process (long queries...) and 2) ajax function to check that main process's result. (you can store the result in file, db or memcache...)
Then it only takes a few ms to go back to the server to check for the result. Users won't see loading cursor anymore.