forked from nuzil/translate-for-ukraine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
81 lines (81 loc) · 3.1 KB
/
index.php
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
<html>
<head>
<script src="jquery-3.5.1.min.js"></script>
<style>
.location {
display: none;
}
.location .title {
font-size: 22px;
}
</style>
</head>
<body>
<div id="intro">
<h2>Де Вам потрібна допомога</h2>
<div>
<div class="location" id="support_ausl_amt">
<div class="title">Імміграційна служба та служба громадян </div>
<span class="languages"></span>
<span class="channels"></span>
</div>
<div class="location" id="support_doctor">
<div class="title">Врач чи Лікарня</div>
<span class="languages"></span>
<span class="channels"></span>
</div>
<div class="location" id="support_education">
<div class="title">Дитячий садок чи школа</div>
<span class="languages"></span>
<span class="channels"></span>
</div>
<div class="location" id="support_amt">
<div class="title">інші офіційні процедури</div>
<span class="languages"></span>
<span class="channels"></span>
</div>
<div class="location" id="support_other">
<div class="title">Інше</div>
<span class="languages"></span>
<span class="channels"></span>
</div>
</div>
</div>
<div id="contact">
</div>
<script>
$.ajax('getAvailableChannels.php', // request url
{
dataType: 'json',
success: function (data, status, xhr) { // success callback function
$.each( data, function( key, value ) {
$("#" + key).show();
// $.each( value.languages, function( valueKey, value ) {
// $("#" + key + " .languages").append("<div>" + value + "</div>");
// });
var channelCounter = 0;
$.each( value.channels, function( valueKey, value ) {
$("#" + key + " .channels").append("<div data-id='" + valueKey + "' class='channel-link'>" + value + "</div>");
channelCounter++;
});
if (channelCounter == 0) {
$("#" + key + " .channels").append("<div>Not Available</div>");
}
});
$(".channel-link").click(function(){
var channel = $(this).attr("data-id");
var location = $(this).parent().parent().attr("id");
$.ajax('getContact.php?channel=' + channel + "&location=" + location,
{
dataType: 'json',
success: function (data, status, xhr) {
$("#intro").hide();
$("#contact").append(data.name + " - Contact:" +data[channel])
}
});
});
}
});
</script>
</body>
</html>