ajax有什么问题? [英] what's wrong with ajax?

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

问题描述

有趣的信号与噪音博客文章:

http://37signals.com /svn/archives2/w..._with_ajax.php

interesting "signal vs. noise" blog entry:

http://37signals.com/svn/archives2/w..._with_ajax.php

推荐答案

> ajax有什么问题?


AJAX没什么问题。在MSXML之后不稳定性bug将被修复,

它将会是什么样的:一段很好的代码,其中很多

编程知识在一个相当狭窄的地方表达空间。


错误有了XMLHttpRequest的想法,因为它是由

Firefox和公司实现的。

在资源管理器中MSXML / Microsoft.XMLHTTP对只是
$的一个元素b $ b概念Microsft正在推动市场。在这个概念中,对于单独的数据/布局/样式/行为源而言,相当有点b
$ b的上限。所以XMLHttp请求是数据的一个组成部分

岛技术。在完美的情况下(尚未达到)你

只是从服务器提供XML *数据*,这个数据将定义

本身的布局/样式到使用和附加什么行为

取决于它出现在哪里(桌面,PDA,手机甚至更多

ecsotic places)。并且此数据中的每个节点都知道新接收的信息中的哪个块应该替换当前节点值。所以在

中你理想的只需要获取数据,实际的页面更新就是页面本身的直接更新(这就是数据的全部概念)岛屿。


Firefox和Co要么不理解这个概念,要么就是现在还没有达到它们的价格。在他们的实现中,XMLHttpRequest成为了一种新的和酷的。替换旧的隐藏框架

技巧。因此,如果你仍然将服务器数据加载到一个隐藏的框架中,那你就是b $ b $ lame。如果你使用XMLHttpRequest加载它 - 你很酷。


我想微软的人们正在大笑着看着所有

想要组织这个chiken run :谁将首先实施

最酷和隐藏框架最无bug的替代品。

> what''s wrong with ajax?

Nothing wrong with AJAX. After "MSXML" instability bug will be fixed,
it''s going to be what it is: a good piece of code where a lot of
programming knowledge being expressed on a rather narrow space.

The "wrong" is with the idea of XMLHttpRequest as it was implemented by
Firefox and Co.
In Explorer MSXML / Microsoft.XMLHTTP pair is just an element of the
concept Microsft is pushing on the market. In this concept the rather
old idea of separate data/layout/styling/behaviors sources is brought
to its upper limit. So XMLHttp request is an integral part of the data
island technologies. In the perfect case (which is nor reached yet) you
just serve the XML *data* from the server, and this data will define
itself what layout/styling to use and what behaviors to attach
depending where did it appear (desktop, PDA, cellphone or even more
ecsotic places). And each node in this data knows which chunk of the
newly received information should replace the current node value. So in
the ideal you just need to get the data, and the actual page update is
up to the page itself (this is the whole idea of the "data island").

Firefox and Co either didn''t understand this concept, or it''s simply
not up to them right now. In their implementation XMLHttpRequest became
some kind of "new and cool" replacement for the old "hidden frame"
trick. So if you still load server data into a hidden frame, you''re
lame. If you load it using XMLHttpRequest - you''re cool.

I guess Microsoft people are laughing their heads off by watching all
wannabes organized this chiken run: who will implement first the
coolest and the most bug free replacement for the hidden frame.


呵呵,让''他们拥有它,VK。这是一个很好的帖子。


直到大约一个月前我才蹩脚,现在我很酷,如果我正在阅读

你正确。这个''新AJAX的东西'是我一直在寻找的东西

已经有一段时间了 - 一种方法来获取一些不到一整天的东西

page从服务器。我把隐藏的iframe的东西放得很好,

除了后退按钮。解决方法对我不起作用。现在,

与AJAX的后退按钮并没有那么破碎,但是嘿,我们正在尝试

来编写应用程序 - 这里,而不是web -pages - 。对于在线目录,后退按钮是一个很自然的东西,但你有没见过

库存更新程序?

会发生什么在输入数据后点击返回时?数据库

是否删除了您之前的条目?


我对使用AJAX进行开发的初步印象是它似乎导致

到更清晰的代码,它看起来更快,但它更难调试。

有了iframe,如果你想看看是什么,你就不要隐藏它

服务器正在发送。我还没有找到一个好的通用,简单的方法来调试

ajax服务器脚本 - 但是。


AJAX也没有那么灵活一个iframe,因为你可以使用各种javascript加载你的iframe上的
,其中有一个AJAX

请求,你得到一些文本要处理,以及eval( responseText)

技巧对我来说似乎很脏。


但是,我想我会坚持下去看看我能想出什么。我承认我没有接受过XML,主要是因为缺乏明确的,我可以尝试的简单示例。但是我确实喜欢简单直接地调用服务器获取一些数据,

而不必假装我没有真正得到一个页面并且洗牌

填写给父母。


我想我们将在近期看到很多ajax应用程序

的未来。我希望它非常非常重要。

Hehe, let ''em have it, VK. That was a good post.

I was lame until about a month ago, and now I''m cool, if I''m reading
you correctly. This ''new AJAX thing'' is something I''d been looking for
for quite some time -- a way to fetch something less than a whole darn
page from a server. I got the hidden iframe thing down pretty good,
except for the back button. The workarounds didn''t work for me. Now,
with AJAX the back button isn''t quite as broken, but hey, we''re trying
to write -applications- here, not web -pages-. A back button is a
natural thing for an online catalog, but have you ever seen one on an
inventory update program?
What happens when you hit ''back'' after entering data? Does the database
delete your previous entry?

My initial impression of developing with AJAX is that it seems to lead
to clearer code, it seems to be faster, but it''s MUCH harder to debug.
With an iframe, you just don''t hide it if you want to see what the
server is sending. I haven''t found a good general, simple way to debug
an ajax server script -- yet.

AJAX is also not quite as flexible as an iframe, because you can load
up your iframe with all kinds of javascript, where with an AJAX
request, you get some text to deal with, and the eval(responseText)
trick seems like dirty coding to me.

But, I think I''ll stay with it and see what I can come up with. I have
to admit I haven''t caught on to XML, mostly because of the lack of
clear, simple examples that I can actually try. But I do like the
simplicity and directness of just calling the server for some data,
without having to pretend I''m not really getting a page and shuffling
stuff off to the parent.

I think we''re going to see a LOT of ajax applications in the near
future. I expect it to be very, very significant.


>但是,我想我会坚持下去,看看我能想出什么。


我不鼓励任何人保持跛脚。隐藏的框架! :-)


我只是想说通过XMLHTTP获取一些结构化/非结构化的
服务器数据并不是最先进的进展。在

现实中,它只是在刮擦更大的东西并且更加复杂。


我也看到了两个通用的不稳定问题在AJAX及其传入的

克隆。


(1)内存清理意外终止(用户关闭浏览器

窗口)。使用隐藏框架时,这等于标准情况

我开始加载页面后来改变了主意。这种情况是这样的琐事,从最古老的

浏览器开始,它是防弹的。从其他方面来看,内部XMLHTTP对象往往会在这种情况下显示

不稳定。


(2)AJAX没有内部线程限制(?)。这鼓励用户认为他们可以打开100,200或1000个线程(最多为

资源限制)。事实上,.NET中的maxWorkerThreads限制为每个处理器25个并且
并发连接(在HTTP的比较中,.NET是最慷慨的一个

)。因此,如果你说你的

服务器打开了100个连接,你们都破解了XMLHTTP并违反了你的许可协议

与微软。


PS我真的无法想象甚至需要2个并发连接

除非有人在嗅探我的浏览历史记录(使用定时下载)。

在所有其他情况下它都是一个迹象一个设计得非常糟糕的页面

界面。

> But, I think I''ll stay with it and see what I can come up with.

I do not encourage any one to "stay lame" with hidden frames! :-)

I just ''d like to state that getting some structured/non-structured
server data via XMLHTTP is not the cutting edge of the progress. In the
reality it''s just scraping the surface of something much bigger and
more complicated.

I also see two generic "unstability ussues" in AJAX and its incoming
clones.

(1) Memory clean up on unexpected termination (user closed the browser
window). With hidden frames this equals to the standard situation when
I started to load a page and later changed my mind. This situation is
such a trivia that it''s bulletproof covered starting from the oldest
browsers. From other side internal XMLHTTP objects tends to show
instability in such situations.

(2) AJAX has no internal thread limitations (?). This encourage users
to think that they can open 100, 200 or 1000 threads (up to the
resource limits). In fact maxWorkerThreads in .NET is limited to 25
concurrent connections per processor (and .NET is the most generous one
in the comparison of HTTP). So if you say open 100 connections to your
server, you both cracking XMLHTTP and violating your license agreement
with Microsoft.

P.S. I really cannot imagine a need for even 2 concurrent connections
unless someone is sniffing my browsing history (using timed download).
In all other cases it''s an indication of a very badly designed page
interface.


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

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