Hi,
I am getting kind of confused as I was coding a simple input text box that takes in
a zip code, which then displays a google map with its map api.
I initially started out with ajax in mind, but as i was doing it, I found
that i ended up with a javascript function that takes in the zip code from my form.
The function just initializes the map element from the zip code input, where I can just display it on the page.
My text box has an onkeyup parameter that calls the function as below:
function initialize(str) {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
var geocoder = new GClientGeocoder();
geocoder.setBaseCountryCode("us");
geocoder.getLatLng(
str,
function(point) {
if (point) {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
}
}
);
}
}
I'm probably not that strong in my concepts, so what's this
document.getElementById
part? Is that a javascript thing?
So why do we need ajax then? For cases where javascript is not supported?
Confused.
Brian