-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnav-js.js
More file actions
53 lines (49 loc) · 1.64 KB
/
nav-js.js
File metadata and controls
53 lines (49 loc) · 1.64 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
$('#login').on("click", function(){
window.location.replace("login.html")
})
$('#register').on("click", function(){
window.location.replace("register.html")
})
$('.logout').on("click", function(){
window.location.replace('logout.php')
})
$.ajax({
type: 'POST',
url: 'role.json',
success: function(data){
if(data.role === "Customer"){
$('#guest').css('display', 'none')
$('#customer').css('display', 'inherit')
$('#staff').css('display', 'none')
$('#admin').css('display', 'none')
}
else if(data.role === "Staff"){
$('#guest').css('display', 'none')
$('#customer').css('display', 'none')
$('#staff').css('display', 'inherit')
$('#admin').css('display', 'none')
}
else if(data.role === "Admin"){
$('#guest').css('display', 'none')
$('#customer').css('display', 'none')
$('#staff').css('display', 'none')
$('#admin').css('display', 'inherit')
}
else{
$('#guest').css('display', 'inherit')
$('#customer').css('display', 'none')
$('#staff').css('display', 'none')
$('#admin').css('display', 'none')
}
}
})
$.ajax({
type: 'GET',
url: 'profile.json',
success: function(data){
$('.name').text(data.name)
document.getElementsByClassName('profilePicture')[0].src = data.profile_picture
document.getElementsByClassName('profilePicture')[1].src = data.profile_picture
document.getElementsByClassName('profilePicture')[2].src = data.profile_picture
}
})