404 HTML as responseText
404 HTML as responseText
I want to make a request for a tour, but I get in the answer under the item responseText no JSON but an HTML page with the error code 404 and my page remain blank.
- Bernd Welter
- Site Admin
- Posts: 2695
- Joined: Mon Apr 14, 2014 10:28 am
- Contact:
Re: 404 HTML as responseText
Hello Elena,
here's a functional complete minimal example of how to perform a routing request. Save it as stand alone HTML file and add your token in line 11. You can see the response of the call in your browsers developer tools.
Does this match your requirement?
Bernd
here's a functional complete minimal example of how to perform a routing request. Save it as stand alone HTML file and add your token in line 11. You can see the response of the call in your browsers developer tools.
Does this match your requirement?
Bernd
Code: Select all
<!DOCTYPE html>
<html>
<head>
<title>Xroute Demo</title>
<script src="https://xserver2-europe-test.cloud.ptvgroup.com/services/xroute-client.js"></script>
</head>
<body>
<div id="map">
</div>
<script>
let token = '<your token>';
let xroute = new XRouteClient();
xroute.setCredentials('xtok', token);
let A = {
"$type": "OffRoadWaypoint",
"location": {
"offRoadCoordinate": {
"x": 6.1256572,
"y": 49.5983745
}
}
};
let B = {
"$type": "OnRoadWaypoint",
"location": {
"coordinate": {
"x": 6.1256572,
"y": 49.4816576
}
}
};
xroute.calculateRoute({
"waypoints": [A, B],
"storedProfile": "car",
"resultFields": {
"eventTypes": [
"MANEUVER_EVENT"
],
"guidedNavigationRoute": true,
"polyline": true
},
}, routingCompleted);
function routingCompleted(route, exception) {
console.log(route.distance + 'm in ' + route.travelTime + 's');
console.log(route);
}
</script>
</body>
</html>
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany
Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning...
Technical Partner Manager Developer Components
PTV Logistics - Germany
Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning...