-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuniversities_display.html
More file actions
105 lines (104 loc) · 3.84 KB
/
universities_display.html
File metadata and controls
105 lines (104 loc) · 3.84 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Universities List</title>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.css">
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.js"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f5f5f5;
}
.card {
border: 1px solid #ddd;
border-radius: 8px;
padding: 16px;
margin: 16px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
background-color: white;
width: 300px;
}
.card h2 {
margin-top: 0;
color: #333;
font-size: 1.2em;
}
.card p {
margin: 8px 0;
color: #666;
}
.card a {
color: #0066cc;
text-decoration: none;
}
.card a:hover {
text-decoration: underline;
}
.container {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 20px;
padding: 20px;
}
.error-message {
color: red;
padding: 20px;
text-align: center;
font-weight: bold;
}
.loading {
text-align: center;
padding: 20px;
font-style: italic;
color: #666;
}
</style>
</head>
<body>
<h1>Universities List</h1>
<div id="loading" class="loading">Loading universities...</div>
<div id="error" class="error-message" style="display: none;"></div>
<div id="universitiesContainer" class="container">
<!-- Cards will be populated here -->
</div>
<script>
$(document).ready(function() {
$.ajax({
url: 'new universities list.json',
dataType: 'json',
success: function(data) {
$('#loading').hide();
if (data && data.universities && Array.isArray(data.universities)) {
data.universities.forEach(function(university) {
var card = $('<div class="card"></div>');
card.append('<h2>' + university.name + '</h2>');
card.append('<p><strong>Type:</strong> ' + university.type + '</p>');
card.append('<p><strong>Programs:</strong> ' + university.programs.join(', ') + '</p>');
card.append('<p><strong>Location:</strong> ' +
university.location.city + ', ' +
university.location.state + ', ' +
university.location.country + '</p>');
card.append('<p><strong>Website:</strong> <a href="' +
university.website + '" target="_blank">' +
university.website + '</a></p>');
$('#universitiesContainer').append(card);
});
} else {
$('#error').text('Invalid data format in JSON file').show();
}
},
error: function(jqXHR, textStatus, errorThrown) {
$('#loading').hide();
$('#error').text('Error loading data: ' + textStatus).show();
console.error('Error loading JSON:', textStatus, errorThrown);
}
});
});
</script>
</body>
</html>