2012-09-30 71 views
0

我正在向服務器發送一些數據並將響應接收爲JSON。它按照預期在mozilla和chrome中工作。但在IE中,它要求下載文件,而不是正確解析JSON。有沒有什麼辦法解決這一問題?JSON響應請求下載文件

enter image description here

+1

顯示你的代碼。 – ThiefMaster

+0

請求JSON數據的地方 –

+0

[IE中的Json響應下載(7〜10)]的可能重複](http://stackoverflow.com/questions/13943439/json-response-download-in-ie710) – Joe

回答

0

嘗試在響應指定MIME類型的text/plainapplication/json。或者只需從url中刪除.json擴展名(例如,嘗試.txt.js)。

0

我總是把這段代碼輸出JSON,並與高速緩存沒有問題,特別是在IE

// Expire immediately 
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past 
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 

// always modified 
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false); 
header("Pragma: no-cache");       // HTTP/1.0 

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

print json_encode($output);