В общем вопрос такого плана: есть инпуты из них с помощью жса вытаскиваются из знаячения и по идее помещаются в наверное в функцию ymaps.route
<script src="https://api-maps.yandex.ru/2.1/?lang=ru_RU" type="text/javascript"></script>
<script type="text/javascript">
ymaps.ready(init);
var myMap, route, start, end;
function init(){
myMap = new ymaps.Map ("map", {
center: [47.0105, 28.8638],
zoom: 12,
controls: ['zoomControl', 'typeSelector',
'geolocationControl', 'trafficControl',
'fullscreenControl']
});
order_adress_from.onblur = function() {
start = this.value;
};
order_adress_to.onblur = function() {
end = this.value;
};
ymaps.route([start, end,
]).then(
function (route) {
route && myMap.geoObjects.remove(route);
myMap.geoObjects.add(route);
},
function (error) {
alert("Возникла ошибка: " + error.message);
});
}
</script>Выдает такую ошибку: Uncaught TypeError: Cannot read property 'type' of undefined
Если же пишу переменные с квадратными скобками, пишет что не может построить пути
ymaps.route([ [start], [end],
]).then(
function (route) {
route && myMap.geoObjects.remove(route);
myMap.geoObjects.add(route);
},
function (error) {
alert("Возникла ошибка: " + error.message);
});
}