-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA.html
More file actions
48 lines (48 loc) · 1.27 KB
/
Copy pathA.html
File metadata and controls
48 lines (48 loc) · 1.27 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
<!DOCTYPE html>
<html lang="en" ng-app="ajaxApp">
<head>
<meta charset="UTF-8">
<title>AJAX-GET</title>
<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript" src="js/angular.js"></script>
<script>
angular.module("ajaxApp", [])
.controller("myCtrl", function($scope,$http)
{
$scope.studentss = [];
$scope.getStudents = function()
{
var url = "json/student.json";
//Ajex can be run on the https protocol.
$http.get(url)
.then(function(payload)
{
$scope.studentss = payload.data;
}, function(message)
{
alert('we have ajax issues')
});
};
});
</script>
</head>
<body ng-controller="myCtrl">
<button ng-click="getStudents()">GET STUDENTS:</button>
<br>
<hr>
CILCK ON BUTTON TO GET'S A STUDENTS:
<br>
<table border="1">
<tr>
<th>Name</th>
<th>Enrollment</th>
<th>CGPA</th>
</tr>
<tr ng-repeat="s in studentss">
<td>{ {s.Enrollment} }</td>
<td>{ {s.Name} }</td>
<td>{ {s.cgpa} }</td>
</tr>
</table>
</body>
</html>