开发者

Should I use PHP or Ajax for dynamically loading content into a social website profile?

开发者 https://www.devze.com 2023-01-05 02:59 出处:网络
Getting开发者_如何学编程 some data from a MySQL database and loading it into the page. None of the stuff really needs to be retrieved at any point other than page load, so that advantage of Ajax is mo

Getting开发者_如何学编程 some data from a MySQL database and loading it into the page. None of the stuff really needs to be retrieved at any point other than page load, so that advantage of Ajax is moot. Is there any other advantage to Ajax?


It has the advantage that, if you can defer the retrieval of that data, you can potentially:

  • Make the page load faster (since the content sent will be smaller).
  • Provide more up-to-date content.

Additionally, if that data may not be retrieved, you can potentially:

  • Save bandwidth.
  • Lower the server load.

Finally, you need to use Ajax if you want to display content more recent than when the page was loaded without refreshing it.

EDIT

If you insist on loading everything when the page is loaded, the only possible reason I can concoct is when what you loading depends on some logic implemented in Javascript.

0

精彩评论

暂无评论...
验证码 换一张
取 消