我有一个在大多数浏览器中运行良好的网站,我开始在 IE8 中遇到错误,说 JSON 未定义。互联网告诉我加入 json2.js,一切都会好起来的。
现在它给出了这个错误:
“语法错误”第 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.responseText 中保存的 JSON:
{"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"}