-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion_JS.html
More file actions
30 lines (25 loc) · 1.25 KB
/
Copy pathversion_JS.html
File metadata and controls
30 lines (25 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html>
<html>
<head>
<title>Recepción POST usando JS </title>
</head>
<body>
<h1>Recepción POST usando JS</h1>
<p>Esta página web simple será usada para hacer recepción de dos parámetros enviados mediante petición POST HTTP por el ESP32 y serán representados por pantalla. </p>
<p>Se enviarán dos parámetros: El canal ADC que se está realizando la medición y el valor del ADC</p>
<div>
<p>Canal ADC: <span id="ADC"></span></p>
<p>Valor ADC: <span id="valor"></span></p>
</div>
<script>
//Obtener los parámetros de la URL usando el objeto( o método?) URLSearchParams y lo almacenamos en params
var params= new URLSearchParams(window.location.search);
//Guardamos los valores de los parámetros en dos nuevas variables, que una será tipo char* y la otra uint, lo que pasa es que en estos lenguajes el tipo de var no se declara
var ADCjs=params.get('ADC');
var valorjs=params.get('valor');
//Lo siguiente es pasar estas variables a nuestro documento html asignando los valores a los elementos html correspondients.
document.getElementById('ADC').innerHTML= ADCjs;
document.getElementById('valor').innerHTML=valorjs;
</script>
</body>
</html>