forked from niceplaces/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.html
81 lines (76 loc) · 2.39 KB
/
list.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Lista luoghi di Nice Places</title>
</head>
<body>
<table>
<thead>
<tr>
<th>Numero</th>
<th>Luogo</th>
<th>Area</th>
<th>Facebook</th>
<th>Instagram</th>
</tr>
</thead>
<tbody></tbody>
</table>
</body>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script>
function requestInstagramLikes(url) {
$.ajax({
url: url,
type: "GET",
contentType: "text/html",
success: function (result) {
if (result){
console.log(result);
} else {
alert("Si è verificato un errore!");
}
},
error: function (error) {
console.log(error);
alert("Si è verificato un errore!");
}
});
}
$.ajax({
url: "https://www.niceplaces.it/data/query.php?version=v3&mode=release&p1=getlist",
type: "GET",
contentType: "application/json",
success: function (result) {
const body = $("tbody");
if (result){
console.log(result);
for (let i = 0; i < result.length; i++){
let fb_link = '';
let ig_link = '';
if (result[i].facebook){
fb_link = '<a href="' + result[i].facebook + '" target="_blank">Facebook</a>';
}
if (result[i].instagram){
ig_link = '<a href="' + result[i].instagram + '" target="_blank">Instagram</a>';
//requestInstagramLikes(result[i].instagram);
}
let name = result[i].name;
if (result[i].has_description){
name = "<b>" + name + "</b>";
}
body.append("<tr><td>" + eval(i+1) + "</td><td>" + name + "</td><td>" + result[i].area + "</td>" +
"<td>" + fb_link + "</td><td>" + ig_link + "</td></tr>");
}
} else {
alert("Si è verificato un errore!");
}
},
error: function (error) {
console.log(error);
alert("Si è verificato un errore!");
}
});
</script>
</html>