【问题标题】:xmlhttprequest always return with status code 0 for firefoxxmlhttprequest 总是返回状态码 0 用于 firefox
【发布时间】:2010-04-15 07:07:51
【问题描述】:

我正在尝试使用 xmlhttprequest 对象进行异步调用 所以它在 Internet Explorer 中完全可以正常工作,但对于 firefox 它不会工作

一个小代码sn-p的问题

if (req.readyState == 4)
{
  if (req.status == 200) //here firefox gives status code always 0 and for IE works fine
  {
     //read response              
  } else {
    alert("There was a problem with the request.");
  }
}

【问题讨论】:

    标签: javascript ajax asp.net-ajax xmlhttprequest


    【解决方案1】:

    由于对带有状态码的 firefox 的误解,问题已解决 将 XMLHttpRequest 设为非 HTTP 请求。 因此,它返回状态码为 0

    【讨论】:

    • 我也有同样的问题。你能详细解释一下答案是什么以及你是如何解决的吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-13
    相关资源
    最近更新 更多