Answer the question
In order to leave comments, you need to log in
Why is json not loading?
ymaps.ready(init);
function init () {
var myMap = new ymaps.Map('map', {
center: [55.76, 37.64],
zoom: 10
}),
objectManager = new ymaps.ObjectManager({
clusterize: true,
gridSize: 32
});
objectManager.objects.options.set('preset', 'islands#greenDotIcon');
objectManager.clusters.options.set('preset', 'islands#greenClusterIcons');
myMap.geoObjects.add(objectManager);
$.ajax({
url: "file:///C:/Users/home/Desktop/json/data.json",
dataType: "json",
success: toJsonContainer
}).done(function(data) {
objectManager.add(data);
});
}
Answer the question
In order to leave comments, you need to log in
You can't make AJAX requests to URLs starting with file://
. Blablabla security blablabla security same-origin policy, etc, etc, etc. Solution: raise some web server locally.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question