-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
65 lines (53 loc) · 1.85 KB
/
index.php
File metadata and controls
65 lines (53 loc) · 1.85 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ajax practice</title>
<!-- Bootstrap CSS -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h1 class="mt-3">PHP with Ajax</h1>
<div id="table-load" class="mt-3">
<button id="load-button" class="btn btn-primary">Load Data</button>
</div>
<div id="table-data" class="mt-3">
<!-- <table class="table table-bordered">
<thead>
<tr>
<th>ID</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Akash Thakur</td>
</tr>
</tbody>
</table> -->
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<Script type="text/javascript">
$(document).ready(function() {
$("#load-button").on("click", function(e) {
// e - it meand event
// ajax code starts form here
$.ajax({
url: "ajax-load.php",
type: "POST",
success: function(result) {
$("#table-data").html(result);
}
});
//ajax code end here
});
});
</Script>
</body>
</html>