Hi everyone i develop web map using openlayer.
i use geojson, i have this code from : https://scraperwiki.com/views/openlayers_geojson_example/edit/
this is code :
<script type="text/javascript">
// Start position for the map (hardcoded here for simplicity)
var lat=50.90685
var lon=-1.4029
var zoom=12
var map; //complex object of type OpenLayers.Map
//Initialise the 'map' object
$(function() {
$.getJSON("http://mapit.mysociety.org/area/66016.geojson",
"callback=?",
function(data, textStatus, jqXHR) {
map = new OpenLayers.Map('map', {
layers: [
new OpenLayers.Layer.OSM.Mapnik("Mapnik"),
],
controls: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.Attribution()],
maxResolution: 'auto',
});
var lonLat = new OpenLayers.LonLat(lon, lat)
.transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
);
map.setCenter(lonLat, zoom);
var vector_layer = new OpenLayers.Layer.Vector("GeoJSON");
var geojson_format = new OpenLayers.Format.GeoJSON();
var geometry = geojson_format.parseGeometry(data);
geometry.transform(
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
);
var feature = new OpenLayers.Feature.Vector(geometry);
vector_layer.addFeatures([feature]);
map.addLayer(vector_layer);
})
});
</script>
in :
$.getJSON("http://mapit.mysociety.org/area/66016.geojson",
"callback=?",
it works when i call from iis localhost i try to change like this :
$.getJSON("assets/json/66016.geojson",
"callback=?",
but it didnt work, :(
please help me why and how to make this work.
this is the wrong :
HTTP Error 404.0 - Not Found localhost --- >/assets/json/66016.geojson?callback=jQuery152048599341535009444_1366340277133&_=1366340277237
Sorry guys, finnaly i get my answer this is the solve :
$.getJSON("assets/json/66016.geojson",
"callback=?",
just erase "callback=?",
$.getJSON("/assets/json/66016.geojson",