0

我对Google Places API有疑问。我试图向谷歌发送一个地方,但我收到了 400 错误。

  var send = {
    "location": {
      "lat": 25.696183,
      "lng": 8.136408
    },
    "accuracy": 25,
    "name": "Google Shoes!",
    "types": ["Schuhgeschäft"],
    "language": "de"
  }
  var request = $.ajax({
    url: 'https://maps.googleapis.com/maps/api/place/add/json?sensor=false&key={KEY}',
    type: 'POST',
    data: send,
    crossDomain: true,
    dataType: 'JSONP',
    success:function(json){
         alert("Success");
     },
     error:function(){
         alert("Error");
     }
  });

在调试控制台中,我收到此错误:

GET https://maps.googleapis.com/maps/api/place/add/json?sensor=false&key={KEY}&callback=jQuery183005409403680823743_1355988904458&location%5Blat%5D=48.696183&location%5Blng%5D=8.136408&accuracy=25&name=Google+Shoes!&types%5B%5D=Schuhgesch%C3%A4ft&language=de&_=1355988904466 400 (Bad Request) 
4

1 回答 1

0

您需要输入实际的密钥。另外,我认为它们不支持 JSONP 或 POST。

于 2013-01-03T20:09:39.280 回答