3. El servicio procesa la request y genera la response
index.html
const respuesta =
await consumeJson("srv/devuelve.php")
alert(`Nombre: ${respuesta.body.nombre}
Mensaje: ${respuesta.body.mensaje}`)
Hace wait esperando response.
srv/devuelve.php
devuelveJson([
"nombre" => "pp",
"mensaje" => "Hola."
]);
Procesa la request y
genera response
(respuesta).
Response
HTTP/1.1 200 OK
Server: openresty
Date: Fri, 02 May 2025 03:41:22 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: max-age=0
Expires: Fri, 02 May 2025 03:41:22 GMT
{"nombre":"pp","mensaje":"Hola."}
skip_previous
skip_next