当我尝试向 Google 地方信息添加地点时,出现错误:
{"readyState":0,"responseText":"","status":0,"statusText":"error"}
这是我的代码:
HTML:
<form id="addShopForm">
...
<a type="submit" id="submitshop">Submit</a>
</form>
查询:
$('#submitshop').click(function(){
$.ajax({
type: "POST",
url: "https://maps.googleapis.com/maps/api/place/add/json?sensor=true&key=asdEFasdBaasdasdasdMrN2ST5tRS5c",
crossDomain: true,
data: {
"location": {
"lat": 68.7425471,
"lng": 9.1370879
},
"accuracy": 50,
"name": "Test Shop!",
"language": "de"
},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
alert(JSON.stringify(msg));
},
error: function (errormessage) {
alert(JSON.stringify(errormessage));
//{"readyState":0,"responseText":"","status":0,"statusText":"error"}
}
});
});