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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:20:22+00:00 2026-05-28T01:20:22+00:00

This is driving me nuts. Using Google Maps v3 I am loading the map

  • 0

This is driving me nuts. Using Google Maps v3 I am loading the map using php to determine lat long :

function initialize() {
    var latlng = "<?php echo $lat;?>,<?php echo $long;?>";
    console.log(latlng);
    var mapOptions = {
        center: new google.maps.LatLng(<?php echo $lat;?>,<?php echo $long;?>),
        zoom: 8,
        mapTypeId: google.maps.MapTypeId.ROADMAP 
    };
    var map = new google.maps.Map(document.getElementById("map_canvas")
                                       , mapOptions);
}

This works fine. However if I try to pass in the latlng var

center: new google.maps.LatLng(latlng),

the maps just shows a blue screen and is broken (no zoom or controls or anything). The console log and source look like it is generating the parameters correctly. Any ideas on what might be happening?

I did have initialize() on body but I moved it to the (document).ready in my script. This did not seem to make any difference for this problem.

  • 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-05-28T01:20:23+00:00Added an answer on May 28, 2026 at 1:20 am

    This is because

    new google.maps.LatLng(<?php echo $lat;?>,<?php echo $long;?>)
    

    is not the same as

    new google.maps.LatLng("<?php echo $lat;?>,<?php echo $long;?>")
    

    The quotes mean you are passing in a string literal to the LatLng constructor, which does not work.

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

Sidebar

Related Questions

This is driving me nuts. http://www.cssdrive.com/index.php/examples/exampleitem/focus_pseudo_class This is an example of using the hover
This is driving me nuts. I am using some 3rd-party code in a Windows
This error message is driving me nuts. I'm getting it when using Html.ListBox and
This is driving me nuts. I registered a DLL (COM) using regsvr32 blabla.dll In
Sorry to post about this, but it's driving me nuts. I am using routes
This is driving me nuts, I can't see the problem. Using jQuery (I'm stuck
This is driving me nuts, I have a login function that checks to make
This is driving me nuts. I can't seem to get the data template within
This is driving me nuts. I think it is because of some connection string
This is driving me nuts. I believe I asked this exact same question, but

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.