forked from JW-Albert/113-2_FCU_Database-Final-Project
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfooter.html
More file actions
44 lines (42 loc) · 2.1 KB
/
footer.html
File metadata and controls
44 lines (42 loc) · 2.1 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
<footer class="site-footer">
<div class="footer-left">
<img id="footer-logo" src="/pics/fcu_logo.svg" alt="逢甲校徽" />
</div>
<div class="footer-right">
<h2>聯絡我們</h2>
<div class="contact-info">
<p id="footer-address">載入中...</p>
<p id="footer-office">載入中...</p>
<p id="footer-phone">載入中...</p>
<p id="footer-email">載入中...</p>
</div>
<script>
// 載入系所聯絡資訊
fetch(BASE_PATH + '/api/department.php?id=D001')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
if (data.success) {
const dept = data.data;
document.getElementById('footer-address').textContent = `地址:${dept.locat || '無資料'}`;
document.getElementById('footer-office').textContent = `系辦:${dept.office || '無資料'}`;
document.getElementById('footer-phone').textContent = `電話:${dept.phone_extension || '無資料'}`;
document.getElementById('footer-email').textContent = `信箱:${dept.email || '無資料'}`;
} else {
throw new Error(data.message || 'Failed to load department info');
}
})
.catch(error => {
console.error('Error loading department info:', error);
document.getElementById('footer-address').textContent = '地址:載入失敗';
document.getElementById('footer-office').textContent = '系辦:載入失敗';
document.getElementById('footer-phone').textContent = '電話:載入失敗';
document.getElementById('footer-email').textContent = '信箱:載入失敗';
});
</script>
</div>
</footer>