开发者

XMLHttpRequest responseText empty intermittently - FireFox 3.5 Mac OS or FireFox 3.5 with Firebug

Pulling my hair 开发者_StackOverflowout please does anybody have the solution?

In the readystate event handler, I simply read responseText - it comes back as emptystring/blank, 1 out of 100 times when I use FireFox 3.5 + Firebug on Windows Vista, or 1 out of 10 times when using FireFox 3.5 on Mac OS.

The bizarre thing is that the responseText seems to get filled in during the time it takes to do a breakpoint and read the value, for example:

var responseText = request.responseText;
if(responseText == "") {
  alert("breakpoint here");
}

When the breakpoint hits, responseText is emptystring but request.responseText has the correct response.

It seems tentitively like a kind of timing issue or bug in FireFox/FireBug or does somebody have an idea?

Thanks! - Brian


I had the same problem. It was working in IE, but not FF. The problem was that the page calling the ajax was a secure page and the page generating the response was not a secure page. I'm not sure why FF let it work sometimes, but IE would give me a prompt. I made both pages secure and it seems to have fixed the issue.


i have the same problem but only is on the Mac OS machine, the problem is that Firefox treat the ajax response as an "cross domain call", in any other machine works fine, im not find any help about this (i think that is a firefox's implementation issue),but i going to prove the next code in the server side:

header('Content-type: application/json');

to ensure that browser get the data "as json data" ...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜