-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo.html
30 lines (28 loc) · 1.3 KB
/
demo.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
<div id="json_data" style="color:#000"> JSON CONTENT TO DISPLAY HERE </div>
<script>
let jreq = new XMLHttpRequest();
let jurl = 'https://raw.githubusercontent.com/brihat-rb/nep_cal_data_scraper/master/2077.json';
jreq.open('GET', jurl, true);
jreq.onload = function() {
let jresponse = JSON.parse(this.response);
// console.log(jresponse);
let json_content = "";
for (let j = 0; j < 12; j++) {
for (let i = 0; i < 32; i++) {
if (jresponse.data[j][i]) {
json_content += jresponse.data[j][i].date + "<br />  ";
json_content += jresponse.data[j][i].tithi + "<br />  ";
if (jresponse.data[j][i].event_one)
json_content += jresponse.data[j][i].event_one + "<br />  ";
if (jresponse.data[j][i].event_two)
json_content += jresponse.data[j][i].event_two + "<br />  ";
if (jresponse.data[j][i].event_three)
json_content += jresponse.data[j][i].event_three + "<br />  ";
json_content +="<hr />";
}
}
}
document.getElementById("json_data").innerHTML = json_content;
}
jreq.send();
</script>