vendredi 11 août 2017

AJAX problems with sending POST, and getting result

Im new at JS and JSON. So I need to send a JSON massive to Google API using POST, and get the answer and show it via alert. I wrote this page, but this code has no result.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://ift.tt/nYkKzf">
<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>Redericting</title>
  <script src="http://ift.tt/eSWUvL"></script>
 </head>
 <body> 
  <script type="text/javascript">
  $.ajax({
        type: "POST",
        url: 'http://ift.tt/2wBhE2s',
        data: '{wifiAccessPoints:["macAddress", "signalStrength"], cellTowers:["cellId", "locationAreaCode", "mobileCountryCode", "mobileNetworkCode"]}',
        dataType: "json",
        success: function(response) {
            alert(response);

        }
    });

  </script>
 </body>
</html>




Aucun commentaire:

Enregistrer un commentaire