I want to use the Bing Maps API to get the coordinates of a location or an address using Javascript.
I generated the request as follows: http://dev.virtualearth.net/REST/v1/Locations?CountryRegion=DE&locality=Munich&addressLine=1%20Schloss%20Nymphenburg&maxResults=1&key={myKEY}
When I open manually the link, I see a JSON-File like this:
But how can I fetch this file, to get the coordinates?
I tried the following code, to show the data on the console, but nothing happens.
var req = new Request(request);
fetch(req)
.then(function(response) {
return response.text();
})
.then(function(text) {
console.log(text);
});
Do I have to import special libraries or is it just the wrong way of doing it?
var req = new Request(request);
—request
is undefined there. - Quentin