Google APIを使用してストリートビューを取得しています。JQuery ajaxリクエストからGoogle Api Street Viewから画像を取得するにはどうすればよいですか?
マイコード:
$.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
タグでバインドします。