Спасибо, я как раз и учусь. В консоли вижу что в save.php передается такой массив
q: {"cod":"200","message":0,"cnt":40,"list":[{"dt":1592492400,"main":{"temp":29.27,"feels_like":29.65,"temp_min":28.75,"temp_max":29.27,"pressure":1017,"sea_level":1016,"grnd_level":1001,"humidity":43,"temp_kf":0.52},"weather":[{"id":802,"main":"Clouds","description":"scattered+clouds","icon":"03d"}],"clouds":{"all":35},"wind":{"speed":1.65,"deg":240},"sys":{"pod":"d"},"dt_txt":"2020-06-23+12:00:00"}],"city":{"id":524901,"name":"Moscow","coord":{"lat":55.7522,"lon":37.6156},"country":"RU","population":1000000,"timezone":10800,"sunrise":1592441057,"sunset":1592504230}}
и пытаюсь на сервере получить из него значение city.name
на сервере выдает ошибку
PHP Notice: Undefined index: q in save.php on line 13
файл save.php такой
<?php
$servername = "";
$username = "";
$password = "";
$db = "";
$conn = new mysqli($servername, $username, $password, $db);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$data = json_decode($_POST['q']);
print_r ($data);
?>