javascript - google maps Uncaught TypeError: Cannot read property 'start_location' of undefined in google maps -


hi have simple function in js google maps , uncaught typeerror

directionresult google directions response object passed other function function.

                var myroute = directionresult.routes[0].legs[0];                 var warnings = document.getelementbyid("warnings_panel");                  (var i=0;i<3;i++)                 {                         warnings.innerhtml += "<br/><br/>start lat = " + myroute.steps[i].start_location.lat() +                                                                      "start lng = " + myroute.steps[i].start_location.lng() + "<br />";                         warnings.innerhtml += "end lat = " + myroute.steps[i].end_location.lat() +                                                                      "end lng = " + myroute.steps[i].end_location.lng() + "<br /> + path :";                                           for(var path=0;path<myroute.steps[i].path.length;path++)                                             warnings.innerhtml += myroute.steps[i].path[path];                                                  }// 

hard tell without more information check myroute.steps array contains @ least 3 elements.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -