You must send a request to api Yandex in js to receive and process data. Trying to write an ajax request:
$.ajax({ url: 'https://api-maps.yandex.ru/services/route/2.0/?callback=id_155276244170680561044&lang=ru_RU&token=e150d8d2f888f6936fee0e67ca1ca581&rll=40.186,58.808~45.10,30&rtm=atm&results=3', type: 'GET', success: function (data) { console.log(data); } });
Or
var url = 'https://api-maps.yandex.ru/services/route/2.0/?callback=id_155276244170680561044&lang=ru_RU&token=e150d8d2f888f6936fee0e67ca1ca581&rll=40.186,58.808~45.10,30&rtm=atm&results=3'; var xhr = new XMLHttpRequest(); xhr.open('POST', url, false); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.send(data);
But I just can not display data in the console (If you go to this address on the address bar, then everything is fine, the data is displayed. Maybe I’m generally digging in a different direction.
PS An error falls to the console:
Access to XMLHttpRequest at 'https://api-maps.yandex.ru/services/route/2.0/?callback=id_155276244170680561044&lang=ru_RU&token=e150d8d2f888f6936fee0e67ca1ca581&rll=40.186,58.808~45.10,30&rtm=atm&results=3' from origin 'http://anew' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
PSS Or is it all solved on the side of the backend by parsing?