是否有进展jQuery的阿贾克斯更新事件? [英] Are there progress update events in jQuery ajax?

查看:196
本文介绍了是否有进展jQuery的阿贾克斯更新事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有长时间运行的任务,它被使用jQuery AJAX调用。我使用的是块UI插件显示加载。反正我有可以发送进度消息回客户端,以显示进度,并有更新块UI插件的消息。

i have long running task that gets called using jquery ajax. i am using the block ui plugin to show "loading". is there anyway i can send progress messages back to the client to show progress and have that updated on the block ui plugin message.

所以它会显示这个(如服务器不工作)。

So it will show this (as the server does its work) . .

加载第一个来源。结果
加载第二个来源。结果
装第三个来源。结果
分析结果。

推荐答案

这是我所看到上传的东西的情况下 - 人们创建一个单独的网关和查询它进步的信息,因为它只是在服务器端avaliable。但我认为这不是你的情况的最好的事情。

From what I've seen for the case of uploading stuff - people create a separate gateway and query it for progress info as it's only avaliable on the server side. But I think it's not the best thing in Your case.

如果要加载的东西与进度的信息或让服务器的流行资讯的进展而产生的输出则的 HTTP流的就是你想要的。它很好地覆盖 这里 。基本上它是一个HTTP请求到该服务器的大块一分钟左右的响应(发送因此当东西就是了),然后一个新的连接被打开。

If You want to load stuff with progress information or allow server to pop info on progress while generating output then http streaming is what You want. It's covered nicely here. Basically it's a single http request, to which the server responds in chunks for a minute or so (therefore sending stuff when it wants) and then a new connection is opened.

这是我相当发现;)

目前有很多更好的技术avaliable,所有的人都包裹在 Socket.IO - 使用的WebSockets回退其他技术,包括的 HTTP流

Currently there are lots of better techniques avaliable, and all of them are wrapped up in Socket.IO - Websockets with fallbacks to other techniques including http streaming

Socket.IO为的NodeJS的模块,但也有其他和类似的实现。我已经从 https://github.com/Atmosphere/atmosphere

Socket.IO is a module for nodeJS, but there are other and similar implementations. I have already exchanged some packets with JAVA Socket.IO implementation from https://github.com/Atmosphere/atmosphere

这篇关于是否有进展jQuery的阿贾克斯更新事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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