7. El servicio devuelve la response, que es recibida en el cliente
index.html
const respuesta = await consume(
submitFormRecibeJson(
"api/procesa.php", formulario))
const json =
await respuesta.json()
alert(json)
Despierta y recibe response.
Response
HTTP/1.1 200 OK
Server: openresty
Date: Sun, 17 May 2026 21:24:23 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: max-age=0
Expires: Sun, 17 May 2026 21:24:23 GMT
"Hola pp."
Memoria
- respuesta
-
- status
- 200
- body
- "Hola pp."
- json
- "Hola pp."
api/procesa.php
$saludo = recibeTexto("saludo");
$nombre = recibeTexto("nombre");
$resultado =
"{$saludo} {$nombre}.";
devuelveJson($resultado);
Devuelve response y se duerme.
skip_previous
skip_next