【发布时间】:2016-04-20 05:59:48
【问题描述】:
我正在使用 Google API 获取街景。
我的代码:
$.ajax({
url: 'https://maps.googleapis.com/maps/api/streetview?size=600x300&location=46.414382,10.013988&heading=151.78&pitch=-0.76&key=MY_KEY',
contentType: "image/jpeg",
type: 'GET',
cache: false,
success: function(data) {
console.log('got data', data);
},
error: function(error) {
console.log('Error', error);
}
});
MY_KEY 是我的 Google API 密钥,location 将根据特定地点的纬度和经度动态变化。
但它总是进入error。
如果它成功运行,我希望它绑定在 html img 标签中。
【问题讨论】:
标签: javascript jquery html ajax google-api