ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

OSM for ERPnext

I want to use OSM in a field in ERPNext, to show map. Below is my code for map using open route service, but not able to add it into a HTML field in ERPNext. Can someone please help me?

let request = new XMLHttpRequest();
request.open(‘POST’, “https://api.openrouteservice.org/v2/matrix/driving-car”);

request.setRequestHeader(‘Accept’, ‘application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8’);
request.setRequestHeader(‘Content-Type’, ‘application/json’);
request.setRequestHeader(‘Authorization’, ‘key’);

request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log(‘Status:’, this.status);
console.log(‘Headers:’, this.getAllResponseHeaders());
console.log(‘Body:’, this.responseText);
var data = this.responseText;
var jsonResponse = JSON.parse(data);
console.log(jsonResponse.destinations[0].snapped_distance);
}
};

const body = ‘{“locations”:[[9.70093,48.477473],[9.207916,49.153868]]}’;

request.send(body);
Thankyou