Mootools:为什么PHP中的每个flush()都没有反映在mootools事件的用户端
我正在 mootools 中开发一个应用程序。有一些代码使用 Request 类向服务器发送请求。
req = new Request({
async: false, method: 'post',
someEvent: function(currentChunk)
{ /* this event is fired everytime when server flushes the output using flush()*/ },
onSuccess: function(html) { responseProcessor(); },
onFailure: function() { alert('Page Loading Failed ....!!'); },
});
在服务器端,它执行一个 PHP 文件,我在其中使用刷新输出缓冲区 冲洗()。 但在接收端,有一个 onSuccess 事件,它在一个变量中为我提供了整个responseData。
每次服务器刷新输出缓冲区后是否会触发任何事件?
i am developing an application in mootools.There is some code which sends request to server using Request class.
req = new Request({
async: false, method: 'post',
someEvent: function(currentChunk)
{ /* this event is fired everytime when server flushes the output using flush()*/ },
onSuccess: function(html) { responseProcessor(); },
onFailure: function() { alert('Page Loading Failed ....!!'); },
});
At the server side, it executes a PHP file where i am flushing output buffer using
flush().
but at receiving end, there is onSuccess event which gives me whole responseData in one variable.
Is there any event which is fired after every single time server flushes the output buffer.?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
API 上记录了一个进度事件: http://mootools.net/docs/core/Request /请求
there is an progress event documented on the API: http://mootools.net/docs/core/Request/Request
onSuccess 回调将整个响应作为参数传递。如果您进行 AJAX 调用,它会返回您直接访问该脚本时将在浏览器上呈现的所有内容作为响应。使用 mootools Request 您无法显示输出的进度(刷新后无法调用事件)。我不知道是否有一个 moo 插件可以做这样的事情。
附注
我知道有一个 jQuery 插件可以为你做点什么(Does PHPlush work with jQuery ajax?)
The onSuccess callback passes the whole response as parameter. If you make an AJAX call, it returns as response all the stuff that would be rendered on the browser if you accessed that script directly. With mootools Request you can't show the progression of the output (there couldn't be events called after a flush). I don't know if there is a moo plugin that does something like this.
p.s.
I know there's a jQuery plugin that could do something for you (Does PHP flush work with jQuerys ajax?)
我检查了他的 anwser 中包含的链接 Steeb 中指出的 JQuery AJAX Http Stream 插件。
它所做的只是一个轮询。您可以扩展 MooTools.Core.Request 类并创建一个 MooTools.Core.Request.Polling 类,该类将添加一些选项(例如轮询)。
您将需要实现“请求”事件(在发送请求之前触发)来设置轮询和完成事件来停止轮询。
I checked the JQuery AJAX Http Stream plugin pointed out from the link steweb included in his anwser.
All it does is just a polling. You could extend the MooTools.Core.Request class and create a MooTools.Core.Request.Polling class which would add some options like the polling.
You will need to implement the 'request' event (triggered just before the request is sent) to set up the polling and the complete event to stop it.