Google Maps API Tutorial© 2006, 2007, 2008, 2009 Mike Williams
|Translate this page:|
The fundamental philosophy of AJAX is to load the static parts of your webpage only once, and request a small amount of information about the bits that change from a server. This makes changing the displayed data much faster.
My new website does have PHP, so this example now uses it. Clicking the [A], [B] and [C] buttons causes the current markers to be cleared and a fresh set of information to be loaded from the corresponding XML file.
Here's a really simple PHP script that reads this data file, finds the marker that's "nearest" to the ?lat= &lng= parameters that are passed in the URL, and outputs the data as XML. [Somebody with more experience in PHP could probably write it a lot better than that].
Here's that script in action map11a.php?lat=43.85&lng=-79.1
You can see the difference by reloading the example page, instead of clicking on the [A] icon.