什么时候适合使用AJAX? [英] When is it appropriate to use AJAX?

查看:155
本文介绍了什么时候适合使用AJAX?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当它是适当的使用AJAX?
什么是使用AJAX的利弊?

When is it appropriate to use AJAX?
what are the pros and cons of using AJAX?

在回应我的最后一个问题:有些人显得很坚定地认为我应该只使用AJAX,如果情况是适当的: <一href="http://stackoverflow.com/questions/549280/should-i-add-ajax-logic-to-my-php-classes-scripts">Should我添加AJAX逻辑的到我的PHP类/脚本?

In response to my last question: some people seemed very adamant that I should only use AJAX if the situation was appropriate: Should I add AJAX logic to my PHP classes/scripts?

在回应乍得桦木的回答: 是的,我指的是开发一个标准的网站,将采用AJAX为它的好处时,也不会被它的应用被削弱。在某种程度上会杀了搜索排名是不能接受的使用AJAX。因此,如果保持现场完整需要更多的工作,比这将是一个骗子。

In response to Chad Birch's answer: Yes, I'm referring to when developing a "standard" site that would employ AJAX for its benefits, and wouldn't be crippled by its application. Using AJAX in a way that would kill search rankings would not be acceptable. So if "keeping the site intact" requires more work, than that would be a "con".

推荐答案

这是一个pretty的大问题,但你应该使用AJAX来提升用户体验,而不会使该网站完全依赖于它。请记住,搜索引擎和其他一些游客将无法执行AJAX,所以如果你依靠它来加载您的内容,不会对你有利。

It's a pretty large subject, but you should be using AJAX to enhance the user experience, without making the site totally dependent on it. Remember that search engines and some other visitors won't be able to execute the AJAX, so if you rely on it to load your content, that will not work in your favor.

例如,你可能会认为,这将是不错的用户访问你的博客,然后在页面动态加载最新的文章(S)与AJAX一旦他们已经在那里了。然而,当谷歌试图索引你的博客,它只是要得到的空白网站。

For example, you might think that it would be nice to have users visit your blog, and then have the page dynamically load the newest article(s) with AJAX once they're already there. However, when Google tries to index your blog, it's just going to get the blank site.

有一个很好的搜索词找到与此相关的学科资源是渐进增强。有很多好的东西在那里,花一些时间围绕以下的链接。这里有一个开始你了:

A good search term to find resources related to this subject is "progressive enhancement". There's plenty of good stuff out there, spend some time following the links around. Here's one to start you off:

http://www.alistapart.com/articles/progressiveenhancementwithjavascript/

这篇关于什么时候适合使用AJAX?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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