2013-06-11 37 views
2

我有一個網站,否則在大多數瀏覽器中運行良好,我開始在IE8中出現錯誤說JSON是未定義的。互聯網告訴我放入json2.js,事情就會好起來。IE8中的JSON語法錯誤?

現在,它給出了這樣的錯誤:

「語法錯誤」 行204字7"

這是行204:

var data = JSON.parse(jqXHR.responseText); 

我已經試過這些事:

1. <!DOCTYPE html> 
2. <meta http-equiv="X-UA-Compatible" content="IE=EDGE" /> 
3. <script src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.min.js"></script> 

我驗證的JSON是有效的JSON,我沒有想法,我應該在哪裏看下一個?

編輯2:

這將是更容易,如果我只是張貼暫時鏈接:http://pilot032013.herokuapp.com/address/51376f833ef9eb361f354ebc/

編輯1:

function getUncuratedBuildingSuccess(jqXHR, textStatus) { 
    //console.log(jqXHR.responseText); 
    var data = JSON.parse(jqXHR.responseText); 
    CURRENT_BUILDING_ID = data.id; 
    //Load Images 
    generateImageUrls(data.id); 

    //Some point soon, I want to have a building object reflect the database 
    building_footprint = fixBrokenFootprint(data.points); 
    var building = new google.maps.Polygon({ 
     path: building_footprint, 
     strokeColor: "#6f298b", 
     strokeOpacity: 0.8, 
     strokeWeight: 2, 
     fillColor: "#ad2390", 
     fillOpacity: 0.35 
    }); 
    extendBounds(building); 

    building_location = new google.maps.LatLng(data.center[1], data.center[0]); 
    building.setMap(map); 
    displayAddress(data.dte_addresses); 
    displayGSVImage(data.dte_addresses); 
    displayParcel(data.parcel_id); 
    displayStatus(replaceAmbig(data.override)); 
    //displayPastVotes(data.id); 
} 

下面是jqXHR舉行的JSON。 responseText:

{"suffix": "", "owner_mail_state": "None", "parcel_id": "4562354", "street_name": "", "owner_mail_zipcode": "None", "living_area": "None", "imaging_runs": ["20130307_004341_4"], "owner": "None", "num_floors": null, "id": "51424ad73ee3eb75fc5deae1", "city": "Boston", "owner_mail_address": "None", "energy_score_raw": "24.5240226853", "structural_class": "None", "zipcode": "49525", "state": "MI", "override": "None", "assessor_lot": "None", "street_num": "", "owner_mail_city": "None", "geocoded_address": [], "unit_num": "None", "use_description": "None", "vertical_panoramas": [["20130307_004341_4_r_1482539_mts", "20130307_004341_4_r_1482524_mts", "20130307_004341_4_r_1482555_mts", "20130307_004341_4_r_1482570_mts"]], "building_style": "None", "assessor_map": "None", "exterior_material": "None", "fireplace": "None", "roof_type": "None", "use_code": "None", "year_built": "None", "center": [-85.6279876548728, 43.028673273958084], "energy_score_city": 69, "year_remodeled": "None", "air_conditioner": "None", "created_at": "2013-06-11T15:20:12.301190", "heat_type": "None", "owner_occupied": "None", "contract": "dte", "energy_score_neighbors": 79, "points": [[-85.6279345148065, 43.0287278589084], [-85.62793027273129, 43.0286178277214], [-85.6280408213034, 43.0286193662203], [-85.6280455189338, 43.0287278763051], [-85.6279345148065, 43.0287278589084]], "num_units": "None", "yme_addresses": [{"_changed_fields": [], "site_id": "3390379", "_initialised": true, "_created": false, "_data": {"city": "Boston", "suffix": "ROAD NE", "state": "MA", "street_name": "4 MILE", "is_contracted": null, "zipcode": "49525", "prefix": null, "street_num": "1665"}, "ser_seq": "1"}], "_id": "None", "gross_area": "None"} 
+2

給出您的數據回覆。如果您向我們提供ajax請求的數據,我們將有想法 – Sophy

+1

嘗試您的鏈接在IE8模式下,我在json3庫內加載時出現javascript錯誤。這似乎是這個bug:https://github.com/bestiejs/json3/issues/35這顯然是在使用非縮小版本或3.2.5時解決的。科。不知道這是整個問題還是別的什麼。請注意,標準模式下的IE8不需要JSON填充,它應該可以開箱即用。 – jods

+0

給定鏈接錯誤:「SCRIPT5007:無法獲取屬性值的長度':對象爲空或未定義 json3.min.js,第13行字符93」。此外,它引用了json3而不是json2,如上所述。 –

回答

0

你可以得到這種類型的錯誤的情況下的

<script src="...url..."></script> 

URL不回你的鏈接中找到的JavaScript

0

腳本註釋。

GET http://cdnjs.cloudflare.com/ajax/libs/json3/3.2.5/json3.min.js 404 (Not Found) pilot032013.herokuapp.com:31 

再次檢查您的JavaScript CDN,確保它正常工作。

+0

檢查並修復。現在我有一個新的錯誤,長度未定義。我猜這是一個腳本錯誤。 –

+0

請在IE8上評論console.log()。它不知道控制檯 – Sophy