Firstly you dont need the  google.load() call. that loads the API -
which does the same as the script tag. Its an alternative method of
loading the API - via the google common loader.

You also need a &async=2 in the script tag, to be able to use the callback param

So

function StartMap() {
    var script = document.createElement("script");
    script.src =
"https://maps-api-ssl.google.com/maps?file=api&v=2&client=CLIENTIDWASHERE&sensor=false&async=2&callback=LoadMap";;
    script.type = "text/javascript";
    document.getElementsByTagName("head")[0].appendChild(script);
}

function LoadMap() {
    //Code here
}

should be all that is required.



On Mon, Feb 6, 2012 at 9:11 AM, Coder Bloke <coderbl...@gmail.com> wrote:
> Hi,
>
> I am trying to dynamically load Google Maps onto a page when the StartMap
> fucntion below is called. I am using Google Maps for Business (client ID not
> API key), version 2 of the API, https and a callback.
> The documentation has various URL examples on calling but non in this
> scenario.
>
> For the URL we have also tried:
> http://maps.googleapis.com/maps?file=api&v=2&client=CLIENTIDWASHERE&sensor=false&callback=LoadApis
> https://maps-api-ssl.google.com/maps?file=api&v=2&client=CLIENTIDWASHERE&sensor=false&callback=LoadApis
>
> and many others.
> Hope someone can help.
>
>
> function StartMap() {
>     var script = document.createElement("script");
>     script.src =
> "https://maps.googleapis.com/maps?v=2&client=CLIENTIDWASHERE&sensor=false&callback=LoadApis";;
>     script.type = "text/javascript";
>     document.getElementsByTagName("head")[0].appendChild(script);
> }
>
> function LoadApis() {
>     google.load("maps", "2", { "callback": LoadMap });
> }
>
> function LoadMap() {
>     //Code here
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps API V2" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-maps-api/-/blpDZFidJLkJ.
> To post to this group, send email to google-maps-api@googlegroups.com.
> To unsubscribe from this group, send email to
> google-maps-api+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-api+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to