$(function() {
var sampleMarkerData = [
{
"title": "Stockholm",
"lat": 59.3,
"lng": 18.1,
"description": "Stockholm is the capital and the largest city of Sweden and constitutes the most populated urban area in Scandinavia with a population of 2.1 million in the metropolitan area (2010)"
},
{
"title": "Oslo",
"lat": 59.9,
"lng": 10.8,
"description": "Oslo is a municipality, and the capital and most populous city of Norway with a metropolitan population of 1,442,318 (as of 2010)."
},
{
"title": "Copenhagen",
"lat": 55.7,
"lng": 12.6,
"description": "Copenhagen is the capital of Denmark and its most populous city, with a metropolitan population of 1,931,467 (as of 1 January 2012)."
}
];
var loadAPIPromise;
// Load API
var loadAPIShared = function loadAPI(callback) {
if (!loadAPIPromise) {
var deferred = $.Deferred();
console.log('send request to get google maps api');
$.ajax({
url: 'http://www.google.com/jsapi/',
dataType: "script",
success: function() {
google.load('maps', '3', {
callback: function() {
deferred.resolve();
},
other_params: 'sensor=false'
});
}
});
loadAPIPromise = deferred.promise();
}
loadAPIPromise.done(callback);
};
var googleMaps = function() {
var $el,
apiLoaded = false;
// Init
//...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!