难道是一个好主意,Ajax加载页面内容? [英] Would it be a good idea to AJAX to load page content?

查看:97
本文介绍了难道是一个好主意,Ajax加载页面内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,可以说,而不是使用PHP来加载中间部分的网页(页眉和页脚之间的内容)的网站的index.html页面?

Basically, lets say for the index.html page of a website, instead of using php to load the middle section( content between header and footer ) of the webpage?

推荐答案

您可能会遇到的情况,这是很好的。举例来说,如果你的页的确是一个相当重量级的客户端Web应用程序,那么也许这是正确的选择。但是总的来说,这是一个可怕的想法。

You may come across a situation that this is good for. For instance, if your "page" is really a rather heavy-weight client-side web application, then perhaps this is the right choice. Generally though, this is a terrible idea.

您在生成已注入你的内容的页面有哪些危害如何?您避免兼容性问题,搜索引擎优化的问题,它加载很快,而且少了一个HTTP请求到服务器。仅仅因为这将这一理念良好的JS框架的存在并不意味着它是正确的方法为您的应用程序。

What harm do you have in generating a page already filled with your content? You avoid compatibility issues, SEO issues, it loads quickly, and that's one less HTTP request to your server. Just because "good JS frameworks that incorporate this philosophy" exists doesn't mean it is the right method for your application.

每个网站是不同的,但默认答案应该是肯定不会。如果条件合适,那么是的。基地这一决定什么是最适合你的用户。

Each site is different, but the default answer should be certainly not. If the conditions are right, then yes. Base this decision on what is best for your users.

这篇关于难道是一个好主意,Ajax加载页面内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆