ajax成功没有在firefox中触发

时间:2022-10-02 21:12:04

I have a strange problem that I cant' solve after hours of googling. The way my web application is built is not very optimal, but I can't do anything about this right now.

我有一个奇怪的问题,我不能在谷歌搜索后解决。构建我的Web应用程序的方式不是很理想,但我现在无法做任何事情。

I have made a User Control in C#. This usercontrol is hosted by a aspx-page that are inside an iframe and this page is inside a frame again. (Not optimal).

我在C#中创建了一个用户控件。此用户控件由位于iframe内的aspx页面托管,此页面再次位于框架内。 (不是最佳的)。

But I think the only important thing is the outer frame. The hosting page there is on another domain than the other pages/parts.

但我认为唯一重要的是外框。托管页面位于另一个域而不是其他页面/部件。

Inside this frame is my code. I have a jquery scripts that updates the data when it detects new data on the server. To get the data I use jquery-ajax.

在这个框架内是我的代码。我有一个jquery脚本,当它在服务器上检测到新数据时更新数据。要获取数据,我使用jquery-ajax。

 var indexURL = "/data/indexProxy.aspx";

__LOG("Lets get the XML");
$.ajax({
    url: indexURL,
    type: 'GET',
    dataType: 'xml',
    contentType: "text/xml; charset=\"utf-8\"",
    error: function(request, error) {
        alert('Error loading XML document' + request + error);
    },
    success: function(xml) {
        __LOG("ajax success...");
        OnSucceededXml(xml);
    }
});

The __LOG function just write to the firebug console.

__LOG函数只是写入firebug控制台。

So the this code runs great until something happends. Not quite sure how it happens but sometimes when the function fails or gets intrrupted, it just stops working. I think it's related to page-reloads inside the ajax function.

因此,此代码运行良好,直到发生某些事情。不太确定它是如何发生的,但有时当功能失败或被中断时,它就会停止工作。我认为这与ajax函数中的页面重新加载有关。

After this happends the success function never gets trigged. In the firebug consule, I can see the "Lets get the XML" message, I can see the ajax-call is triggers and returns 200 or 304(not modified). But the __LOG inside the success is not triggered nor the function.

发生这种情况后,成功函数永远不会被触发。在firebug consule中,我可以看到“Lets get the XML”消息,我可以看到ajax-call是触发器并返回200或304(未修改)。但__LOG里面的成功并不是触发也不是功能。

To make it work again I have to restart firefox completely and sometimes empty the cache.

为了使它再次工作,我必须完全重启firefox,有时清空缓存。

If I open the page that is inside the frame of the other domian, outside the frame, everything works again, but I can't really do this as its part of the app.

如果我在框架外面打开另一个domian框架内的页面,一切都会再次运行,但我不能真正做到这一点作为应用程序的一部分。

Anyone experienced something simular? Also I don't thing this is releated to jquery, as I have expriensed some thing simmular in older scripts.

有人经历过类似的事吗?另外,我并不认为这与jquery相关,因为我在旧脚本中已经表达了一些类似的东西。

Thanks

谢谢

Endre

恩德雷

2 个解决方案

#1


0  

This could be due to the fact that you're doing a cross-domain request in Firefox, which I believe is forbidden by Firefox's default policy. Apparently you can tweak the setting, but for internet-facing sites, I don't think that's going to fly, and you will have to find another way.

这可能是因为您在Firefox中执行跨域请求,我认为这是Firefox的默认策略禁止的。显然你可以调整设置,但对于面向互联网的网站,我认为不会飞,你必须找到另一种方式。

Have you traced the output from the Console window in Firebug?

您是否在Firebug中跟踪控制台窗口的输出?

#2


0  

you MIGHT try putting a async: false, in your call.

你可以尝试在你的通话中输入一个async:false。

Note sure what you mean by "page-reloads inside the ajax function."

请注意“ajax函数中的页面重新加载”的含义。

#1


0  

This could be due to the fact that you're doing a cross-domain request in Firefox, which I believe is forbidden by Firefox's default policy. Apparently you can tweak the setting, but for internet-facing sites, I don't think that's going to fly, and you will have to find another way.

这可能是因为您在Firefox中执行跨域请求,我认为这是Firefox的默认策略禁止的。显然你可以调整设置,但对于面向互联网的网站,我认为不会飞,你必须找到另一种方式。

Have you traced the output from the Console window in Firebug?

您是否在Firebug中跟踪控制台窗口的输出?

#2


0  

you MIGHT try putting a async: false, in your call.

你可以尝试在你的通话中输入一个async:false。

Note sure what you mean by "page-reloads inside the ajax function."

请注意“ajax函数中的页面重新加载”的含义。