-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremoteforms.html
More file actions
40 lines (32 loc) · 1.37 KB
/
remoteforms.html
File metadata and controls
40 lines (32 loc) · 1.37 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
31
32
33
34
35
36
37
38
39
40
<html>
<head>
<!--JQUERY-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<div>
<h1>Test de la mort</h1>
<hr/>
<form id="form"> <!--action="/htmldata" method="POST"-->
<input id="apartments" name="apartments" type="number" value="" min="1" max="999" maxlength="3" >
<input id="var2" name="var2" type="number" value="" placeholder="number">
</form>
<h2 id="result">Resultat</h2>
</div>
<script>
//post
$("input[type='number']").change(function(event) {
console.log("nombre pas envoye" + $('#apartments').val())
$.post("<herokuappurl>/htmldata", {//heroku app url don't forget to use cors in app.js
apartments: $('#apartments').val(),
var2: $('#var2').val(),
},
//callback results of calcul into object data.
function(data){
console.log("Result received: " + data.result)
$("#result").text(data.result + " est le resultat" + "et la somme deux resultats est : " + data.somme);
});
});
</script>
</body>
</html>