-
Notifications
You must be signed in to change notification settings - Fork 0
/
index2525.html
30 lines (30 loc) · 953 Bytes
/
index2525.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
<html>
<head>
<title>Ambulance 2525</title>
<script
type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.8/socket.io.min.js"
></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<!-- <script src="index.js"></script> -->
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
var socket = io.connect("http://localhost:8000");
socket.on("connect", function() {
console.log("User has connected!");
socket.on("ambulance", data => {
console.log("calling");
alert(data);
console.log("received message");
});
$("#sendbutton").on("click", function() {
socket.emit("sending", "2525 coming");
});
});
});
</script>
<button id="sendbutton">Send Ambulance</button>
</body>
</html>