Mitzu Wrushi
Mitzu Wrushi

Reputation: 11

Where should I use my Google API Key in my code base?

$.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address=' + addresses[i] + '&sensor=false', null, function (data) {


var p = data.results[0].geometry.location
var latlng = new google.maps.LatLng(p.lat, p.lng);

var marker = new google.maps.Marker({

    position: new google.maps.LatLng(p.lat, p.lng),
    map: map,
    icon: marker_icon, // This path is the custom pin to be shown. Remove this line and the proceeding comma to use default pin

});


bounds.extend(marker.position);

Where should I use my Google API Key?

Is there meant to be a new entry in the marker for an API key?

Upvotes: 1

Views: 67

Answers (2)

Ofir Baruch
Ofir Baruch

Reputation: 10346

https://maps.googleapis.com/maps/api/geocode/json?address={address}&key={YOUR_API_KEY}

Source - Google Maps API

Upvotes: 1

Noel Carcases
Noel Carcases

Reputation: 721

<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"></script>

inside your html

source

https://developers.google.com/maps/documentation/javascript/

Upvotes: 0

Related Questions