PDA

View Full Version : Asynchronous Loading of the GMaps API to use only DirectionsRequest



rafaelrp
10 Mar 2014, 7:17 PM
Hello!

I need to use only the DirectionsRequest services of google maps, without showing the map, anyone knows a way to do that?

There's a way to integrate with Ext?

I've tried to do this:



function loadScript(){
var script = document.createElement('script');
script.type ='text/javascript';
script.src ='https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&'+
'callback=initialize';
document.body.appendChild(script);
}


But with no success.

I need to use the googe.maps.DirectionsRequest object to get routes.


Thanks!!

chramer
11 Mar 2014, 11:03 PM
This worked fine for me:


Ext.Loader.loadScriptFile('https://www.google.com/jsapi', function(){
google.load("maps", "3", {
other_params:"sensor=false",
callback : function() {}
});
},Ext.emptyFn,null,false);