[Edit: 30.10.2012: Check the post PTV xServer Web App Demo A-to-B Routing – a demonstration of the benefits of JSON with a concrete example]
We’ve updated the Code Sample Browser with a preview of the PTV xServers 1.16. Therefore the JSON API has slightly been changed. Here’s a brief update on the information we provided in the blog article of July 2012.
The PTV xServer add-on AJAX Maps API did not change. The information we provided is still up to date. What has changed are the scripts, constructors and method calls for xRoute and xLocate. To include xRoute and xLocate in your HTML-page, these lines must be provided:
<!--xRoute JSON --> <script type="text/javascript" src="/xroute/xroute-client.js"> </script>
<!--xLocate JSON --> <script type="text/javascript" src="/xlocate/xlocate-client.js"> </script>
The constructor calls now look like this:
var xroute = new XRouteClient(); var xlocate = new XLocateClient();
The method signatures also changed a little bit. Asynchronous calls do not need the ‘Async’ suffix anymore. We just moved the callback handler to the last position in the method call and made it optional. So if a callback handler is provided the method will be executed in asynchronous mode. Here is an example for this:
xroute.calculateRoute(waypoints, null, null, rlo, cc, routeCalculated);
We highly recommend to use the asynchronous mode only.
That’s all! Give it a try in the Code Sample Browser!