]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/directions/mapquest.js
Improve error handling for routing engines
[rails.git] / app / assets / javascripts / index / directions / mapquest.js
index 2210664888e94b8062a9fe280322c9123f47754f..f46d94dcff92447328a979bf5356a753f76aa5bb 100644 (file)
@@ -48,7 +48,7 @@ function MapQuestEngine(id, routeType) {
           generalize: 0,
           unit: "k"
         },
-        dataType: "json",
+        dataType: "jsonp",
         success: function (data) {
           if (data.info.statuscode !== 0)
             return callback(true);
@@ -83,12 +83,15 @@ function MapQuestEngine(id, routeType) {
             steps.push([L.latLng(s.startPoint.lat, s.startPoint.lng), d, s.narrative, s.distance * 1000, lineseg]);
           }
 
-          callback(null, {
+          callback(false, {
             line: line,
             steps: steps,
             distance: data.route.distance * 1000,
             time: data.route.time
           });
+        },
+        error: function () {
+          callback(true);
         }
       });
     }