6. El servicio genera la response
index.html
const respuesta = await consume(
enviaFormRecibeJson(
"php/procesa.php", formulario))
const json =
await respuesta.json()
alert(json)
Hace wait esperando response.
srv/procesa.php
$saludo = recibeTexto("saludo");
$nombre = recibeTexto("nombre");
$resultado =
"{$saludo} {$nombre}.";
devuelveJson($resultado);
Memoria (Servidor)
- $saludo
- "hola"
- $nombre
- "pp"
- $resultado
- "hola pp"
Response
HTTP/1.1 200 OK
Server: openresty
Date: Fri, 02 May 2025 13:14:10 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: max-age=0
Expires: Fri, 02 May 2025 13:14:10 GMT
"Hola pp."
skip_previous
skip_next