S
S
shdprogrammer2016-08-10 14:29:52
JavaScript
shdprogrammer, 2016-08-10 14:29:52

How to display data on Yandex map using LoadingObjectManager?

Good day. I'm trying to display elements on the Yandex map using LoadingObjectManager. I used to work with cards quite a bit, so I might not know something. The code:

ymaps.ready(function (ymaps) {

        var Map = new ymaps.Map('mymap', {
            center: [48.65,44.39],
            zoom: 10,
            controls: ["zoomControl", "fullscreenControl"]
        });

        var loadingObjectManager = new ymaps.LoadingObjectManager('url'+'?bbox=%b',
            {
                clusterize: true,
                clusterHasBalloon: false,
                geoObjectOpenBalloonOnClick: false
            });
        Map.geoObjects.add(loadingObjectManager);
    });

The map is loaded, the request to the server leaves, the data is returned, but there are no objects on the map. What am I doing wrong? Thanks in advance.
UPD: Data is returned from the server in the format, as in the docks on the map:
callback_name({
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "id": 0,
      "geometry": {
        "type": "Point",
        "coordinates": [55.831903, 37.411961]
      },
      "properties": {
        "balloonContent": "Содержимое балуна",
        "clusterCaption": "Метка 1",
        "hintContent": "Текст подсказки"
      }
    },
    {
      "type": "Feature",
      "id": 2,
      "geometry": {
        "type": "Point",
        "coordinates": [55.763338, 37.565466]
      },
      "properties": {
        "balloonContent": "Содержимое балуна",
        "clusterCaption": "Метка 2",
        "hintContent": "Текст подсказки"
      }
    }
  ]
})

Data wrapped in callback

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Tvolod, 2016-11-11
@Tvolod

Is the function name in the request and response the same? Those. the answer should be:

echo $_GET['callback'];
?>({
....данные
?>})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question