原型 Ajax 对象实际上并未在 IE 8 中发出请求
我有一个包含以下 javascript 代码的 JSP 页面:
var refreshAjax = {};
function refreshDataOnClickHandler()
{
Event.stopObserving($("refreshdata"), "click", refreshDataOnClickHandler);
refreshAjax = new Ajax.Request("/Locator",
{method: "get",
onSuccess: onRefreshDataSuccessHandler,
onFailure: onRefreshDataFailureHandler,
parameters: {
serviceCenter: $("servicecenterselect").getValue(),
action: "RefreshData"
}
});
}
function onRefreshDataSuccessHandler(response)
{
$("dashboardmessage").update("Data Refreshed.");
$("mapRefresh").src = "Images/RefreshData.png";
refreshAllStopsAndTrucks();
Event.observe($("refreshdata"), "click", refreshDataOnClickHandler);
}
Event.observe($("refreshdata"), "click", refreshDataOnClickHandler);
$("refreshdata") 解析为锚标记。 “/Locator”解析为 Java Servlet。 我使用的是 IE 8。 我正在使用原型 1.6.1。
我第一次加载页面并单击“refreshdata”时,Servlet 被正确调用,并且我得到了预期的响应。每当我点击“refreshdata”锚点时,Javascript 似乎都会执行调用的步骤,甚至表明它得到了响应。然而,servlet 从未被实际调用过。实际上没有发送任何响应。
让它再次正常工作的唯一方法是关闭 IE 8 并重新启动。
这在 Chrome 和 Firefox 上可以正常工作。有谁知道 IE 浏览器有什么奇怪之处导致它无法在 IE 中运行?
I have a JSP page with the following javascript code:
var refreshAjax = {};
function refreshDataOnClickHandler()
{
Event.stopObserving($("refreshdata"), "click", refreshDataOnClickHandler);
refreshAjax = new Ajax.Request("/Locator",
{method: "get",
onSuccess: onRefreshDataSuccessHandler,
onFailure: onRefreshDataFailureHandler,
parameters: {
serviceCenter: $("servicecenterselect").getValue(),
action: "RefreshData"
}
});
}
function onRefreshDataSuccessHandler(response)
{
$("dashboardmessage").update("Data Refreshed.");
$("mapRefresh").src = "Images/RefreshData.png";
refreshAllStopsAndTrucks();
Event.observe($("refreshdata"), "click", refreshDataOnClickHandler);
}
Event.observe($("refreshdata"), "click", refreshDataOnClickHandler);
The $("refreshdata") resolves to an anchor tag.
"/Locator" resolves to a Java Servlet.
I'm using IE 8.
I'm using Prototype 1.6.1.
The first time I load the page and click "refreshdata" the Servlet is called correctly and I get the expected response. Every other time I click the "refreshdata" anchor the Javascript seems to go through the steps of making the call and even indicates that it gets a response. However, the servlet is never actually called. No response is actually sent.
The only way to get it to work correctly again is to shut down IE 8 and restart it.
This works correctly on Chrome and Firefox. Does anyone know what strangeness of the IE browser is keeping this from working in IE?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IE 可能正在缓存 Ajax GET 请求的结果。
如果您想始终从服务器获取最新数据,您应该
一些相关链接:
IE is probably caching the result of the Ajax GET request.
If you want to always get the latest data from the server, you should either
Some relevant links: