tags:

views:

248

answers:

0

hi,

i m using google map api v3 , geocode service. here i m sending latitude and longitude of any location and getting it's address.

i want to store it into a global variable and want to return it to the caller.

i m calling this script function from vb.net 2005 webbrowser control.

so can any one suggest me that how it will return a address , or how can i put a delay till address not assign to the variable.

var geocoder = new
google.maps.Geocoder();
var str;


function geocodePosition(lat,lon)  {
try { 
    var pos = new  google.maps.LatLng(lat,lon);   
geocoder.geocode({latLng:pos,language:"EN"},function(responses)     {
    if (responses && responses.length > 0)   {  
//document.getElementById('address').innerHTML=responses[0].formatted_address;  
str=responses[0].formatted_address;



      }

     });

} catch(err)   {   txt="There was an
error on this page.\n\n";  
txt+="Error description: " +
err.description + "\n\n";  
txt+="Click OK to continue.\n\n";  
alert(txt);   } }