async function submit() {
let user = {
name: 'John',
surname: 'Smith'
};
let response = await fetch('/a2018/api/translate.php', {
method: 'POST',
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
body: JSON.stringify(user)
});
let result = await response.json();
alert(result.message);
}
body: JSON.stringify(user)
php://input
var_dump(file_get_contents('php://input'));