The program is currently running, but the interface is annoying because of the alert() function, which I use in the getData() function! and when I remove this line from the getData() function, the whole program goes wrong! I do not know what's the problem? Does anyone have a better idea for such a process?
The program I'm trying to do is aimed at helping users find a restaurant within a radius of 50 km from their current address, I have already collected various location addresses and recorded it in the database.
initialize() function that is called when the HTML body is loaded, in the first lines of the HTML body restaurant data will be extracted from MySQL using PHP, which will print the data in JavaScript arrays jsres_add, jsres_id, jsres_name and jsnu so that I can use them in JavaScript code . * note that JavaScript code like the one below is split into a .js file
var geocoder, location1, location2, gDir, oMap, jsnu, arraynu, address2; jsres_add = new Array(); jsres_id = new Array(); jsres_name = new Array(); function initialize() { geocoder = new GClientGeocoder(); gDir = new GDirections(); GEvent.addListener(gDir, "load", function() { var drivingDistanceMiles = gDir.getDistance().meters / 1609.344; var drivingDistanceKilometers = gDir.getDistance().meters / 1000; if (drivingDistanceKilometers < 50){
source share