即时通讯和JSON新的。所以我需要使用POST向Google API发送大量JSON,并通过警报获取答案并显示它。我写了这个页面,但是这段代码没有结果。发送POST的AJAX问题,并获得结果
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Redericting</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$.ajax({
type: "POST",
url: 'https://www.googleapis.com/geolocation/v1/geolocate?key=KEY',
data: '{wifiAccessPoints:["macAddress", "signalStrength"], cellTowers:["cellId", "locationAreaCode", "mobileCountryCode", "mobileNetworkCode"]}',
dataType: "json",
success: function(response) {
alert(response);
}
});
</script>
</body>
</html>
看来你是不是传递JSON数据,但字符串值数据属性 –
你的数据对象应该是'数据:{wifiAccessPoints:“MACADDRESS”,“signalStrength”],发射塔: [“cellId”,“locationAreaCode”,“mobileCountryCode”,“mobileNetworkCode”]},//删除单引号 –
@serdar.sanri谢谢你,这是错误的。但现在也没有回应 – Aleksandr