2
我不知道它是由jQuery還是由我的腳本引起的。這是Internet Explorer 9的給出錯誤:Internet Explorer 9給出parseJSON錯誤
parseJSON: function(data) {
// Attempt to parse using the native JSON parser first
if (window.JSON && window.JSON.parse) {
return window.JSON.parse(data); <<< this the "Invalid Character" err.
}
這是我的javascript代碼
從我的研究,我也檢查了我的DOCTYPE這裏。他們在談論怪癖模式,所以我也試圖把x-ua-compatible
,但什麼都沒有改變
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" > <!-- IE9 mode -->
blabla
爲什麼IE9給jQuery的無效字符錯誤?而不是Firefox或Webkit。哦,順便說一下,我正在使用jQuery 1.9.1。
由於您使用的是jQuery,爲什麼不將'post()'請求的'dataType'設置爲'json'並讓jQuery處理解析呢? – 2013-03-09 07:48:30
你能告訴我一個例子嗎?我正在使用我的數據,如'x.name,x.page ...' – 2013-03-09 07:49:34
http://api.jquery.com/jQuery.post/我查看了dataType,這很酷現在我不需要使用parseJSON,但是我仍然想知道爲什麼IE給出了錯誤:D – 2013-03-09 07:55:02