-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
37 lines (28 loc) · 692 Bytes
/
Copy pathindex.html
File metadata and controls
37 lines (28 loc) · 692 Bytes
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
<html>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
Number 1 : <input name = 'num1' id ='num1'>
<br>
Number 2 : <input name = 'num2' id = 'num2'>
<br>
<input id = 'res' placeholder="Output">
<button>Add</button>
<script>
$('button').click(function() {
var num1 = document.getElementById('num1').value;
var num2 = document.getElementById('num2').value;
$.ajax({
url: "/",
type: "post",
data: {
'a' : num1,
'b' : num2
},
success: function(response) {
document.getElementById('res').value = response;
},
error: function(xhr) {
}
});
});
</script>
</html>