There is a piece of code that does not want to work, with all this, it does not produce any errors - everything except it works, but it does not.

The bottom line is that after clicking on a button on a site, he should display a textbox with a total distance and a sum of money, but this does not happen, although he does not show any errors.

JsFiddle code link

The part of the code that, I suspect, works somewhere wrong:

total_summary = '<div class="alert alert-success">'; if (COSTOFLENGTH) { var summary_cost = (COST + (Math.round(distance / 100) / 10 * COSTOFLENGTH)).toFixed(2); total_summary += ' <strong>Total Distance : </strong>' + showDistance(distance) + " ( about " + Math.round(time / 60) + " minutes) " + "<i class='fa fa-eur' aria-hidden='true'></i> " + summary_cost; } else if (COST) { total_summary += ' <strong>Total Distance : </strong>' + showDistance(distance) + " ( about " + Math.round(time / 60) + " minutes) " + "<i class='fa fa-eur' aria-hidden='true'></i> " + COST; } else if (MSG) { total_summary += ' <strong>' + MSG + '</strong>'; } total_summary += '</div>'; $("#summary").html(total_summary); map_zoom = map.getZoom(); $("#loader").html(''); } else { var statusText = getDirectionStatusText(status); //directionsDiv.innerHTML = "An error occurred - " + statusText; } 
  • Ps. It turns out that in general no JS functions specified in the script work - neither the construction of the route, nor the calculation of the price, nothing. - Deniss Akmaikin
  • Submit the full js + html code - doox911

0