On Oct 12, 5:27 am, AThinerCoin <[EMAIL PROTECTED]> wrote:
> I'm trying to call showAddress from another function because I'd like
> to print the user input back to the screen after the map changes.
> When I hit the "submit" button, it echoes just fine, but the map
> disappears and the page does not stop loading.

I don't see that. I get an infoWindow with the address in it, on a
geolocated marker.

The problem is that showAddress() doesn't actually return a value for
printtwice() to work with. Consequently return_value is always null
and the document.write statement never gets executed. If you replace
      return_value = showAddress(city);
with
      showAddress(city);
and remove all reference to return_value, you should find it works.
The document.write statement will be reached before the geocoder
result is returned and the map is updated. This is a record of what
the user searched for, and uses that data. Note that if you want to do
anything with the data returned from the geocoder, you need to put
that code inside the callback function. That runs asynchronously,
which means it's independent of the main program thread and can't pass
data back.

It's bad form to use document.write like this, because you're adding
to the DOM [document object model] after it's been defined. It's
better to set up a <div id="mydiv"> to receive this text, and then
maintain a variable with the content you want displayed in it, and set
document.getElementById("mydiv").innerHTML to the value of that
variable to display it on the screen.

Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to