forked from benallfree/socialworth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
61 lines (45 loc) · 1.35 KB
/
demo.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
<!DOCTYPE html>
<html>
<head>
<title>Socialworth Demo</title>
<!-- Include jQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<!-- Example of querying the socialworth script. -->
<script>
$(function() {
$("form").on("submit", function(e) {
e.preventDefault;
url = $(this).find('input[type=url]');
// Abort if we have a request pending.
if(url.attr("disabled")) return false;
// Disable form elements.
$(this).find('input').attr("disabled", "disabled");
$("table").html("");
$("h1").html("Querying …");
url = url.val();
$.getJSON("./demo.php", { url: url }, function(data) {
$("form").find('input').removeAttr("disabled");
$("h1").html(data.count + " ♥");
$.each(data.services, function(service, count) {
var row = $("<tr />");
row.append($("<td />").html(service));
row.append($("<td />").html(count));
$("table").append(row);
});
});
return false;
});
});
</script>
</head>
<body>
<form>
<input type="url" name="url" placeholder="URL to check" />
<input type="submit" value="Check URL" />
</form>
<!-- A display container for the URL's worth -->
<h1></h1>
<!-- A display container for the URL's value on each queried network. -->
<table></table>
</body>
</html>