dongxia9620
2012-08-22 14:55
浏览 103
已采纳

是否异步加载数据会加快页面加载速度?

On my current webpage I load the table content from a mysql db with php. But the db contains about 1500+ rows and they are all encrypted. So it takes about 3 seconds to load them everytime. So I thought about loading them via jquery. Will this be faster? Is it still safe, my current php looks if a session['loggedin'] variable is 1? Can I do the login in check with jquery too?

图片转代码服务由CSDN问答提供 功能建议

在我当前的网页上,我使用php从mysql数据库加载表内容。 但是db包含大约1500多行,并且它们都是加密的。 因此每次加载它们大约需要3秒钟。 所以我想通过jquery加载它们。 这会更快吗? 它仍然是安全的,我当前的php会查看会话['loggedin']变量是否为1? 我也可以使用jquery进行登录吗?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doumao1917 2012-08-22 14:59
    已采纳

    Loading a large data set asynchronously will not be faster. In fact it will be slower (more requests). But doing so might allow you to load smaller chunks of data at a time, and get a more responsive site.

    This has nothing to do with jQuery though. jQuery is just a commonly used JavaScript framework that happens to include some nifty ajax-functionality.

    As for your sequrity concerns, asynchronous requests are handled by the server just like any other requests, so that won't be a problem.

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • dongmeixian9665 2012-08-22 15:01

    Sure, if you use ajax you can allow the rest of the page to show so the user is not left with a blank page while the query is done.

    Ajax will just call another php script so you can do all the same security checks in that script.

    If you are using jquery I would just use .load() as it's extremely simple.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题