2010-04-15 56 views
0

我嘗試使用XMLHttpRequest對象 所以它完全工作在Internet Explorer不錯,但Firefox的它不會工作的問題的XMLHttpRequest總是與狀態碼0返回火狐

一小段代碼進行異步調用

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."); 
    } 
} 

回答

-1

問題已解決,因爲對Firefox的誤解,狀態碼爲 ,導致將XMLHttpRequest設置爲非HTTP請求。 因此,它返回狀態代碼爲0

+3

我有同樣的問題。你能解釋更多關於答案和解決方法嗎? – 2011-08-26 18:35:25