Async/Await
See this stackoverflow question.
PHP and JSON
In the PHP use
$data = json_decode(file_get_contents('php://input'), true);
to get JSON, **not $_POST — the latter is for sending forms.
See this stackoverflow question.
In the PHP use
$data = json_decode(file_get_contents('php://input'), true);
to get JSON, **not $_POST — the latter is for sending forms.