-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
82 lines (69 loc) · 2.54 KB
/
index.html
File metadata and controls
82 lines (69 loc) · 2.54 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
<script>
function Hello($scope, $http) {
$http.get('http://localhost:8080/api/courses').
success(function(data) {
$scope.json = data;
});
}
</script>
</head>
<div ng-controller="Hello">
<div ng-repeat="json in json">
<p>The course is {{json.name}}</p>
<p>and is taught by {{json.instructors[0]}}</p>
<p>it has a {{json.rating}} star rating</p>
<p>from {{json.numberOfRatings}} reviews.</p>
</div>
</div>
</html>
<!--
<div id="div1">
<p> THIS IS MY COURSE RATER </p>
</div>
<script type="text/javascript">
function httpGet(theUrl)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
xmlHttp.send( null );
return xmlHttp.responseText;
}
</script>
<input type = "text"
id = "txtSearch"
onkeydown = "if (event.keyCode == 13)
search()"
/>
<script type="text/javascript">
function search() {
var urlString = "https://crossorigin.me/https://cobalt.qas.im/api/1.0/courses/search?key=456y8hDcetwgug1EGcDxM9XHcrAx84P8&q=\"";
var searchParams = document.getElementById('txtSearch').value;
console.log(searchParams);
var jsonData = httpGet(urlString + searchParams + "\"");
var arr_from_json = JSON.parse(jsonData);
console.log(arr_from_json);
for(i = 0; i < arr_from_json.length; i++){
var courseName = arr_from_json[i].code
var para2 = document.createElement("h2");
var node2 = document.createTextNode(courseName);
para2.appendChild(node2);
var element2 = document.getElementById("div1");
element2.appendChild(para2);
var classMeetings = arr_from_json[i].meeting_sections;
for(j = 0; j < classMeetings.length; j++){
var meetingTimes = classMeetings[j];
for(x = 0; x < meetingTimes.instructors.length; x++){
//console.log(meetingTimes.instructors[x]);
var para3 = document.createElement("p");
var node3 = document.createTextNode(meetingTimes.instructors[x]);
para3.appendChild(node3);
var element3 = document.getElementById("div1");
element3.appendChild(para3);
}
}
}
}
</script> -->