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 8749885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:46:06+00:00 2026-06-13T12:46:06+00:00

Friends, Now i am using google API for getting the Location Info.I am getting

  • 0

Friends,
Now i am using google API for getting the Location Info.I am getting the location info but i am not able to store that neither in variable nor in a hidden field. Can any one help me to know where i am doing mistake.

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>  

   <script language="javascript" type="text/javascript">
    var map;
    var geocoder;// = new google.maps.Geocoder();
    var address;        
    function initialize() {
        var latlng = new google.maps.LatLng(document.getElementById("<%=txtLatitude.ClientID %>").value, document.getElementById("<%=txtLongitude.ClientID %>").value);
        var myOptions = {
            zoom: 5,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById("map"), myOptions);
        var marker = new google.maps.Marker(
        {
            position: new google.maps.LatLng(document.getElementById("<%=txtLatitude.ClientID %>").value, document.getElementById("<%=txtLongitude.ClientID %>").value),
            map: map,
            title: 'Click me'
        });
        geocoder = new google.maps.Geocoder();
        geocoder.geocode({ "latLng": latlng }, function(data, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                address = data[0].formatted_address;
                alert(address);
            }
        });           
        var infowindow = new google.maps.InfoWindow({
        content: 'Location info:' + address + '<br/>LatLng:' + document.getElementById("<%=txtLatitude.ClientID %>").value + ',' + document.getElementById("<%=txtLongitude.ClientID %>").value            
        });
        google.maps.event.addListener(marker, 'click', function() {
            infowindow.open(map, marker);
        });
    }
    window.onload = initialize;
</script>
  • 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-13T12:46:07+00:00Added an answer on June 13, 2026 at 12:46 pm

    You have an error. You are initializing the infowindow with the content before assigning to the marker. Set the content in the event handler.

    This is how your code should be-

     google.maps.event.addListener(marker, 'click', function () {
    
                   infowindow.setContent('Location info:' + address + '<br/>LatLng:' + document.getElementById("<%=txtLatitude.ClientID %>").value + ',' + document.getElementById("<%=txtLongitude.ClientID %>").value);
                   infowindow.open(map, marker);
               });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

friends, right now i am showing list of map overlays on google map using
I know that using friends_work_history permission, we can access friend's work history. Now, I
It's now possible to tag friends and location in feed post https://developers.facebook.com/blog/post/2012/03/07/building-better-stories-with-location-and-friends/ according to
I've been looking for about an hour now, google is not being my friend.
friends, i am opening google map application by using intents and URL to google
I'm using the Facebook php-sdk to get the users name and friends, right now
Hi Friends, I want to use OpenMenu API for Used thair Restaurant Data. now
Friends i am making an application in which i am using Map Activity. Now
I'm using the BLogger API (google) to try and search for certain strings (i.e.'John
While using File.mkdir , and friends I notice that they don't throw exceptions on

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.