我真的不明白我的問題: 我有geojson文件,我需要獲取內容並返回一個有效的變量。獲取文件內容到json/geojson
我的測試:
//this works
var obj_valid = {"type": "FeatureCollection","crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },"features": [{ "type": "Feature", "properties": { "id": "14001", "nom": "val1" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ 0.301, 49.371 ], xxx , [ 0.301, 49.371 ] ] ] ] } }]};
//doesn't work
var obj_fail = $.getJSON("geojson/com/14001.json");
我想回到什麼是我的第一個變種「obj_valid」相同的內容。我試過$ .getJSON,$阿賈克斯,$ .getScript但沒有成功,輸出會有所不同:
什麼是我的錯?
預先感謝您的幫助,