So I'm trying to use the open route service directions API https://openrouteservice.org/dev/#/api-docs/directions/get but so far I cannot find any tutorial on how to use it.
Im sorry for the beginers questions.. This is the code that I'm trying to use:
var request = new XMLHttpRequest();
request.open('GET', 'https://api.openrouteservice.org/directions?api_key=<API-KEY>&coordinates=24.942729,37.443186%7C24.943709,37.444405&profile=cycling-regular');
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
}
};
request.send();
The problem is that the values of the start and end coordinates are inside the link, how i put a variable in there so that every time the user logs a new coordinate value it updates inside the link?