检票:并发Ajax请求仅限于一个? [英] Wicket: concurrent Ajax requests limited to one?

查看:116
本文介绍了检票:并发Ajax请求仅限于一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

状况

在我的Wicket应用程序,我有一个网页,其中包含两个标签。一个选项卡中选择每一次,其内容是通过Ajax获取,这样每次切换到不同的选项卡的内容是加载从服务器。

In my Wicket application, I have a page which contains two tags. Each time a tab is selected, its content is fetched via Ajax so that every time you switch to a different tab its content it loaded fresh from the server.

在我有一个输入字段,它具有一个onblur事件其中通过Ajax保存字段的内容的选项卡之一。

On one of the tabs I have an input field which has an onblur event which saves the contents of the field via Ajax.

问题

如果焦点在输入字段,我点击页面的空白区域,Ajax请求其解雇,并保存数据。

If the focus is on the input field and I click to a blank area of the page, the Ajax request it fired and the data saved.

而不是点击页面上的空白区域。如果,我点击其他选项卡上,Ajax请求保存输入字段被激发而不是Ajax请求,切换标签页。

If, instead of clicking on a blank area of the page, I click on the other tab, the Ajax request to save the input field is fired but not the Ajax request to switch tabs.

被限制在检票一个并发的Ajax请求的数目?

Is the number of concurrent Ajax requests limited in Wicket to one?

推荐答案

但问题是我们AjaxIndicator它覆盖一个DIV在整个页面的每一个Ajax请求的持续时间。而鼠标松开(因此点击)事件到来时,覆盖已经到位,从而失去。通过按住鼠标按钮并释放它的第一个Ajax请求已经完成后覆盖DIV移除,第二个Ajax请求被解雇了。

The problem was our AjaxIndicator which overlays a DIV over the entire page for the duration of each Ajax request. The "mouseup" (and consequently "click") events arrived when the overlay was in place, and thus lost. By holding the mouse button down and releasing it after the first Ajax request had completed and overlaying DIV removed, the second ajax request was fired.

现在看来明显是整个我们之所以有这样的覆盖是prevent用户点击一个Ajax请求正在运行时。

It seems obvious now as the whole reason why we have such an overlay is to prevent users clicking while an Ajax request is running.

我觉得我的解决方法是将禁用某些非常快速的请求,如这些地方是没有意义的有一个指标AJAX指标(不计的请求可能需要更长的时间的情况下,异常高的服务器负载的电位)

I think my solution will be to disable the ajax indicator on certain, very quick requests such as these where it makes no sense to have an indicator (disregarding the potential that requests could take much longer in case of unusually high server load).

这篇关于检票:并发Ajax请求仅限于一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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