Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to wait for google geocoder.geocode?
    primarykey
    data
    text
    <p>Please, help me with google geocoder.geocode. I know that this function runs asynchronous but i do not know how to handle it.</p> <p>How to wait for result? Here is my code: My code do not wait for geocode.geocoder so i get undefined instead geolocation. </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Geocoding service &lt;/title&gt; &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt; &lt;meta http-equiv="content-language" content="cs" /&gt; &lt;meta name="viewport" content="initial-scale=1.0, user-scalable=no"&gt; &lt;link href="http://code.google.com//apis/maps/documentation/javascript/examples/default.css" rel="stylesheet"&gt; &lt;script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false"&gt;&lt;/script&gt; &lt;script&gt; function codeAddress(callback) { var address = document.getElementById('address').value; geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { } else { alert('Geocode was not successful for the following reason: ' + status); } },callback); } function geocoder(result) { alert(codeAddress()); } function button() { geocoder(codeAddress) ; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="panel"&gt; &lt;input id="address" type="textbox" value="address"&gt; &lt;input type="button" value="Go" onclick="button()"&gt; &lt;/div&gt; &lt;div id="map-canvas"&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload