-
Notifications
You must be signed in to change notification settings - Fork 0
/
apiTest1.html
75 lines (54 loc) · 1.75 KB
/
apiTest1.html
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
<!DOCTYPE html>
<html>
<head>
<title>jQuery Template</title>
<!-- jQuery CDN from code.jquery.com -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script>
$(document).ready(function() {
// jQuery code to execute after page load
// calls API which is the 15 most recently published galnet articles
// first article is [0], second is [1], ect.
$.getJSON('https://www.alpha-orbital.com/galnet-feed/', function(json) {
//stores object with function using variable "json" so jQuery can pull specific parts
//section 1
$("#story1Title").text(json[0].title);
$("#story1Date").text(json[0].date);
$("#story1Cont").html(json[0].content);
//section 2
$("#story2Title").text(json[1].title);
$("#story2Date").text(json[1].date);
$("#story2Cont").html(json[1].content);
//section 3
$("#story3Title").text(json[2].title);
$("#story3Date").text(json[2].date);
$("#story3Cont").html(json[2].content);
});
});
</script>
</head>
<body>
<h1>Galnet API display test</h1>
<section id="story1">
<h2 id="story1Title">title</h2>
<p id="story1Date">date</p>
<p id="story1Cont">content</p>
<br> <hr>
</section>
<section id="story2">
<h2 id="story2Title">title</h2>
<p id="story2Date">date</p>
<p id="story2Cont">content</p>
<br> <hr>
</section>
<section id="story3">
<h2 id="story3Title">title</h2>
<p id="story3Date">date</p>
<p id="story3Cont">content</p>
<br> <hr>
</section>
<footer id="footer">
Site by <a href="http://websnoot.com">WebSnoot</a>
</footer>
</body>
</html>