On Oct 22, 4:40 am, Bhaart <[email protected]> wrote:
> Hi!
>
> So I have a problem with geocoding function. I want to use
> geocoded (geocoding works fine) variables: "xp" and "yp" in
> another place in my application code. But this geocoding
> function doesn't return variables. I tried everything.
> Any ideas? It's very important to me.

Geocoding is asynchronous.  You need to use the variables inside the
callback function (once they have come back from the server).

Write a function that uses those variables and call it inside the
callback function is one solution.

Post a link to your map so we can see what you are trying to do and
perhaps we can suggest something.

  -- Larry


> If someone help me, I will be very thankful.
>
> Here is the code:
>
> geocoder.geocode( {'address': adres}, function(results, status) {
>
> if (status == google.maps.GeocoderStatus.OK) {
>
> dlugszer = results[0].geometry.location.toString();
> var npolozenie = dlugszer.split(",",2);
> var xp = npolozenie[0].replace("(","");
> var yp = npolozenie[1].replace(")","");}
>
> else {
> alert("Geokodowanie nie powiodło się z powodu: " + status);
>
>
>
> }
> });

-- 
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.

Reply via email to