views:

48

answers:

2

Hello all.

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.

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).

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.

 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.

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.

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.

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

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.

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

Thanks

Endre

A: 

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.

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

Dave Markle
It might be related to cross-domain requests, but both the requesting page and the ajax source is in the same domain. Its just that it is contained in a frame from another page. It works most of the time, but sometimes it just stops working... very strange.the firebur console outputs the log-line before the ajax call and that the call returns with a 200-returncode.
Endre
Wow, really. So you see the 200 return code, and when you view the output of the call inside Firebug, does the markup look like what you'd expect, or maybe it's malformed and somehow confusing jQuery?
Dave Markle
Thats was so strange. The returned data looks good, and the first line of code in the success function is to log it to firebug console, but it does not get triggered. I have tried to set golbal to false. I think the problem could be in the global Ajax event handler.
Endre
maybe something wrong with __LOG itself? what happens if you just try to *totally* dumb it down and do an alert() on success?
Dave Markle
tried an alert too and it didn't work. It looks like the problem is gone after I set global to false in the ajax call.
Endre
A: 

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

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

Mark Schultheiss
What I ment was that error is not there all the time. It appares sometimes and I can not recreated it. I "think" it happens when the page somehow interrupts the ajax call.
Endre