On Aug 20, 12:26 pm, David van der Tuijn <[email protected]> wrote: > Hey all, > > I am using this tutorial > :http://code.google.com/intl/nl-NL/apis/maps/articles/phpsqlajax_v3.html > > I would like to send the html response from downloadUrl to > bindInfoWindow : > > [code] > var html = "<b>" + id + "</b>"; > > downloadUrl("google-maps/user/" + id, function(data) { > var html = data.responseText; // contains a HTML page, tested it with > alert(). > > }); > > alert(html); > > bindInfoWindow(marker, map, infoWindow, html); > [/code] > > However, the alert result is '<b>1</b>', how come the html variabele > is not set to data.responseText ?
downloadUrl is asynchronous. You have to use the value returned when it arrives from the server (in the call back function). See this page from Mike Williams' v2 tutorial: Javascript Concepts - Part 2 Asynchronous I/O http://econym.org.uk/gmap/async.htm If still can't get it working, please follow the posting guidelines and post a link to your page that exhibits the problem. -- Larry > > i tryed with and without var, so it can't be the scope?!? > > Help appreciated! -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
