Ich bin neu bei JS und JSON. Also muss ich ein JSON mit POST massiv an Google API senden und die Antwort erhalten und per Alert anzeigen. Ich habe diese Seite geschrieben, aber dieser Code hat kein Ergebnis.AJAX Probleme mit dem Senden von POST und Ergebnis
<!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>
Es scheint, dass Sie nicht json Daten, sondern String-Wert sind vorbei in Daten –
Ihre Datenobjekt-Attribut sollte 'Daten: {wifiAccessPoints: [„macaddress“,„Signalstärke“], cellTowers: ["cellId", "locationAreaCode", "mobileCountryCode", "mobileNetworkCode"]} ', // entferne einzelne Anführungszeichen um –
@ serdar.sanri Danke, es war ein Fehler. Aber es gibt keine Antwort jetzt – Aleksandr