为什么AJAX通过iFrames? [英] Why AJAX over iFrames?

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

问题描述

我是一个相对较新的程序员,他跟我告诉我的一个合作伙伴说,在AJAX之前,他使用iframe发送数据并更改内容(显然是在JavaScript的帮助下)。 $ b

我明白这两者都是类似的技术,但我没有找到一篇文章来描述它们的特点,

AJAX优于iframe的优点是什么?

编辑
i没有找到任何关于该技术的解释,但我的合作伙伴告诉我他通过隐藏的iframe发布数据并提交iframe,听起来像iframe必须刷新,但我从来没有这样做过。

解决方案


  1. 一优势AJAX能够读取
    请求的状态/状态。您还可以访问页面标题,而不需要
    Iframe。

  2. Ajax可以处理多个异步请求。这是一个有点麻烦的
    iframes,因为你需要为每个请求创建一个iframe(并保留
    跟踪所有这些以后删除它们),而不是循环使用
    。 >
  3. 现有的库充满了AJAX的优点,还有一个更大的社区支持基础。


I am relatively new programmer, talking with a partner he told me, that before AJAX, he used a iframe to send data and change the content(obviously with help of JavaScript).

I understood that both are similar techniques, but i didn't find a article to describe their characteristic,

what are advantages of AJAX over Iframe ?

EDIT i didnt find any explanation of the technique, but my partner told me he post the data trough a hidden iframe and submit the iframe, sound like just the iframe have to be refreshed, but i never did that

解决方案

  1. One advantage AJAX has is being able to read the state/status of the request. You also have access to page headers, which you don't with Iframes.
  2. Ajax can handle multiple asynch requests. It's a little trickier with Iframes as you need to create an Iframe per request (and keep track of all of them to delete them later) instead of recycling the same one.
  3. Existing libraries are full of AJAX goodness and there is a larger community support base.

这篇关于为什么AJAX通过iFrames?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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