2012-12-20 75 views
0

我與Google Places API有問題。我試圖發送一個地方谷歌,但我有一個400錯誤。Crossdomain Ajax with google places

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) 
+0

您不提供API密鑰而不是佔位符{KEY}。 – Stan

回答

0

你需要把實際的關鍵。另外,我不認爲他們支持JSONP或POST。