我想在 ERPNext 的一个字段中使用 OSM 来显示地图。下面是我使用开放路线服务的地图代码,但无法将其添加到 ERPNext 中的 HTML 字段中。有人可以帮帮我吗?
让请求 = 新 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);
谢谢