我嘗試了幾件事來修復,沒有任何幫助。JSON - 在Internet Explorer 8中不工作
在服務器端腳本,
$array['content'] = "test";
echo json_encode($array);
這是工作中的JavaScript。但是
$array['content'] = "<p>test</p>";
echo json_encode($array);
不工作。如果我添加任何HTML標記,它不起作用。 但他們都在使用Firefox和Chrome。
這是處理返回值的js。
function showResponse(responseText) {
$('.form_result').html(responseText.formData);
alert(responseText.formData);
}
function submitButton1() {
var options = {
beforeSubmit: showRequest, // pre-submit callback
success: showResponse, // post-submit callback
dataType: 'json',
cache: false
};
// bind form using 'ajaxForm'
$('#form').ajaxSubmit(options);
}
header("Cache-Control: no-cache, must-revalidate");
header("Expires: 0");
在php文件中添加了上面兩行。
<meta http-equiv="X-UA-Compatible" content="IE=8" />
添加將處理JS的HTML文件上面。仍然沒有用。
可能是什麼問題?另外,我沒有看到IE中的任何錯誤或警告。
如果IE 8原生JSON特性是問題,你可以用https://github.com/douglascrockford/JSON-js – Andbdrew
的正確實現覆蓋它。我如何使用它?我沒有看到任何示例或步驟來實現這一點。我應該只需要包括他們? – Mahesh
https://github.com/douglascrockford/JSON-js/blob/master/json2.js#L162這是你應該修改補丁ie8 – Andbdrew