Ich mache eine Karte mit Markern. Ich habe die Geokoordinaten vom Abrufen einer Google API Url. Aber für die Marker brauche ich zusätzliche Informationen von anderswo. Ist es möglich, diese zusätzlichen Informationen an die Antwort, die ich vom Abrufen der URL erhalten habe, anzuhängen? Danke vielmals!
Der Code:Ein neues Feld zu Javascript hinzufügen Fetch Antwortobjekt
var location = "Seattle";
var username = "Test user";
var time = "8th March 2017";
function toMap(location, username, time) {
if (location.length > 0) {
var googleURL = "https://maps.googleapis.com/maps/api/geocode/json?address="+location+"&key=Your_API_Key";
fetch(googleURL)
.then(function(response) {
// Can I add "location", "username", and "time" to the response result here
// before returning it?????
return response.json();
})
.then(addMarker);
}
}
Hinweis, "Antwort" ist nicht "response.json()" – guest271314