javascript - Google Directions, bug in common.js? -


i've been using google directions api few days. javascript code worked fine day or two, late 1 night didn't work. in ff console:

typeerror: b undefined[learn more] common.js:49:155

fwiw, common.js line 49 (not code!):

e;_.sb(d);window.gm_authfailure&&window.gm_authfailure()}el();c(b)})})};.cn=function(a,b){a.b();return function(){var c=this,d=arguments;a.f(function(a){a&&b.apply(c,d)})}};dn=function(a,b,c,d,e,f){this.b=new km;this.b.seturl(c.substring(0,1024));f&&(this.b.data[8]=f);d?this.b.data[1]=d:e&&(this.b.data[2]=e);this.b.data[4]=0;this.b.data[5]=1;this.l=a;this.j=b};en=function(a){dl=!0;0!=a.getstatus()||.aj(a,2)||($m(),.p(a,3)&&.sb(_.p(a,3)));el()};

i'm pretty sure error related call in client-side app:

directionsservice.route(myrequest,mycallback);

it's google method asks google directions 1 geographical point another.

here's code: https://pastebin.com/atcfq9tz

ost.setpickupcharge = function(position) {   var p = ost.pickup;   p.lat = position.coords.latitude;   p.lng = position.coords.longitude; /* alert("lat: " + lat + "\nlng: " + lng); */    var request = {     origin: '45 east university avenue, champaign, il',     destination: new google.maps.latlng(p.lat,p.lng),     provideroutealternatives: false,     travelmode: 'driving'   }   function showcost(result, status) {     if (status != 'ok') { alert(status) }     else {       var route = result.routes[0];        var dists = route.legs.map(function(leg) { return leg.distance.value });  p.miles = 0.00062137 * a.sum(dists);       var times = route.legs.map(function(leg) { return leg.duration.value });  p.minutes = a.sum(times) / 60;       p.charge = .6 * p.miles + .15 * p.minutes;       alert("pickup charge = $" + p.charge);       ost.showridebuttons();     }   }   directionsservice.route(request,ost.showcost); } 

well, found bug in own code. it's undefined callback (ost.showcost instead of local showcost).


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -