const respuesta = await consume(
enviaFormRecibeJson(
"php/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 ProblemDetails(
status: ProblemDetails::BadRequest,
type: "/errors/faltasaludo.html",
title: "Falta el saludo.",
);
}
if (
$nombre === false
|| $nombre === ""
) {
throw new ProblemDetails(
status: ProblemDetails::BadRequest,
type: "/errors/faltanombre.html",
title: "Falta el nombre.",
);
}
$resultado =
"{$saludo} {$nombre}.";
devuelveJson($resultado);