const respuesta = await consume(
submitFormRecibeJson(
"api/valida.php", formulario))
const json =
await respuesta.json()
alert(json)
Hace wait esperando response.
$saludo = recibeTexto("saludo");
$nombre = recibeTexto("nombre");
if (
$saludo === false
|| $saludo === ""
)
throw new ProblemDetailsException([
"status" => BAD_REQUEST,
"title" => "Falta el saludo.",
"type" => "/erros/faltasaludo.html"
]);
if (
$nombre === false
|| $nombre === ""
)
throw new ProblemDetailsException([
"status" => BAD_REQUEST,
"title" => "Falta el nombre.",
"type" => "/errors/faltanombre.html"
]);
$resultado = "{$saludo} {$nombre}.";
devuelveJson($resultado);