-
Notifications
You must be signed in to change notification settings - Fork 0
/
gfg.js
58 lines (51 loc) · 1.18 KB
/
gfg.js
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
let paragraph = (function () {
pub = {};
//makePkg = (img, name, descr) => {
makePkg = (title, information, sub_info, img) => {
return `<div class="w-container">
<div class="w-richtext">
<h3 style = "color:rgb(150, 65, 9)"><b>${title}</b></h3>
<blockquote>${information}</blockquote>
${sub_info}
<br>
<img
src="${img}"
loading="lazy"
sizes="(max-width: 479px) 94vw, (max-width: 767px) 95vw, (max-width: 991px) 728px, 940px"
alt=""
/>
</div>
</div>
`;
};
displayPkgs = (pkgs) => {
pkgs.forEach((package) => {
let title = package.title;
let information = package.information;
let sub_info = package.sub_info;
let img = package.img;
$("#main-content").append(makePkg(title, information, sub_info, img));
});
};
pub.setup = () => {
$.ajax({
type: "GET",
url: "gfg.json",
data: {
get_param: "value",
},
dataType: "json",
async: false,
success: function (data) {
let pkgs = [];
pkgs = data.biogs;
displayPkgs(pkgs);
},
error: () => {
alert("Could not load work-package data.");
},
});
};
return pub;
})();
$(document).ready(pub.setup);