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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:21:02+00:00 2026-05-14T18:21:02+00:00

Before you reply: this is not as straight foward as you’d expect! I have

  • 0

Before you reply: this is not as straight foward as you’d expect!

  • I have a ‘show on map’ button which
    when clicked opens a
    dialogbox/lightbox with the google
    map in.
  • I don’t want to load the maps api on
    pageload, just when a map has been
    requested

This is php file the “show on map” button puts into the dialog box:

<div id="map_canvas"></div>

<script type="text/javascript">
    $(function() {  
            //google maps stuff             
            var latlng = new google.maps.LatLng(<?php echo $coords ?>);
            var options = {
              zoom: 14,
              center: latlng,
              mapTypeControl: false,
              mapTypeId: google.maps.MapTypeId.ROADMAP
            };          
            var map = new google.maps.Map(document.getElementById('map_canvas'), options);          
            var marker = new google.maps.Marker({
              position: new google.maps.LatLng(<?php echo $coords ?>),
              map: map
            });
    })
</script>

I’ve been trying to load the API before ajaxing in the dialog like this:

$('img.map').click(function(){      
    var rel = $(this).attr('rel');
    $.getScript('http://maps.google.com/maps/api/js?sensor=false', function(){
        $.fn.colorbox({
            href:rel
        })
    });
})

this doesn’t seem to work 🙁

i’ve also tried:

  • adding <script src="http://maps.google.com/maps/api/js?sensor=false"></script>
    to the ajax file
  • type=”text/javascript” running
    $.getScript('http://maps.google.com/maps/api/js?sensor=false');
    on doc.ready

the problem
the browser seems to be redirected to the api.js file – you see a white screen

  • 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-14T18:21:03+00:00Added an answer on May 14, 2026 at 6:21 pm

    This FAQ answer details how to load the Maps API asynchronously, and there is a good example that goes along with it.

    Basically, recommend you put your execution code in a named function, then load the Maps API referencing said callback and using the “async” parameter. Or you could use jQuery’s getJSON as such:

    $.getJSON('http://maps.google.com/maps/api/js?sensor=false&async=2&callback=?', function(){
        $.colorbox({
            href:rel
        })
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am sorry if this has been posted before. I have searched many websites
Never called an API before and not sure which classes to use in ASP.NET
before I start I want to point out that I tagged this question as
Before asking my question, let me explain the context. CONTEXT: I have a web
(Before I start, yes I have asked a similar question before; unfortunately due to
Before starting, I'm not asking about standard coding practice or etiquette. My question is
Before saying anything I have to say that, albeit I'm an experienced programmer in
Before I ask the question let me state that I have attempted to google
I have this function to unlock a list the user is currently editing: function
I know this question has been asked here a few times before. But i

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.