Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8270745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:40:43+00:00 2026-06-08T06:40:43+00:00

hi i am having the same probem as here Return address from Google Maps

  • 0

hi i am having the same probem as here Return address from Google Maps Geocoder v3 , i dont understand how to set my global variable to the return vlaue

i got this at the moment where b returns undefined

 var a;
 var b;
function outputGeo(result){
    b = result; 
     }


 geocoder.geocode({'latLng': event.latLng},function(results, status) {

         a =  results[1].formatted_address;
         outputGeo(a);
        });  
alert(b);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:40:44+00:00Added an answer on June 8, 2026 at 6:40 am

    geocoder.geocode is an asynchronous function because it’s performing a JSONP request. In other words, before the results have come back, the alert(b) line is already being called. You need to put that alert line into the callback function after outputGeo(a).

    Javascript’s a funny language. This async thing bit me until I researched JSONP and the synchrony of Javascript. I suggest you do the same. A great way to learn about this is to write a JSONP-request wrapper of your own. (Just a thought.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem installing SAM 1.1.0 on fedora 16 same as here https://bugs.php.net/bug.php?id=59632&thanks=6
My goal is to return a start and end date having same value in
I'm having the same problem issued in these two links: one , two .
I'm having the same problem as this question . I tried installing the libcairo
I am having the same problem as this post but the answer does not
I have read some posts having the same problem. I tried to adapt their
Good day everyone. I have been having the same problem all day at work
Edit 1: Uninstalled & Reinstalled Edit 2: Same problem. Seriously? Yes. I am having
having same issue, i am totally new in php. i install XAMPP then download
hello i am having same issue, i tried your solution but it didnt help

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.