D
D
denism3002019-12-26 10:58:54
JavaScript
denism300, 2019-12-26 10:58:54

Yandex.Map is not loading. Error in console ymaps.Map is not a constructor. How to fix?

There is a code to display the map:

function initMap() {
    var myMap = new ymaps.Map('YMapsID', {
        center: [coord_x, coord_y],
        zoom: 9
    }, {
        searchControlProvider: 'yandex#search'
    });
};
ymaps.ready(initMap);

Yandex.Map is not loading. Error in console ymaps.Map is not a constructor. How to fix?
There is only one map on the page, the API is connected once. If you reset the page cache, the map loads, but when you update, the same error occurs again.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2019-12-26
@Seasle

Maybe because of center: [coord_x, coord_y;],this part. How it works? Also, where are the scripts included?

F
FeST1Val, 2019-12-26
@FeST1Val

I hope you replaced it with your ID and your coordinates? or you stupidly copied and pasted and thought that everything would work for you?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question