Pass values of an input and calculate route

0

I have the following code, I am trying to pass the value of an input textbox to a function that calculates a route, the textbox is receiving coordinates from a database elcode is as follows:

document.getElementById('Busca_Camino').addEventListener('click', function () {
         calculateAndDisplayRoute(directionsService, directionsDisplay);
     });
 }

 function calculateAndDisplayRoute(directionsService, directionsDisplay) {
     var start = document.getElementById('TxtInicio').value;
     var end = document.getElementById('TxtFin').value;

     directionsService.route({
         origin: start,
         destination:end,
         travelMode: 'DRIVING'
     }, function (response, status) {
         if (status === 'OK') {
             directionsDisplay.setDirections(response);
         } else {
             window.alert('No se pudo calcular la ruta debido a' + status);
<asp:TextBox ID="TxtInicio" runat="server"  ></asp:TextBox> 
<asp:TextBox ID="TxtFin" runat="server"></asp:TextBox>  
    
asked by Duck_Avila_55 29.11.2017 в 00:16
source

0 answers