https post

This commit is contained in:
barwie2@st.amu.edu.pl 2020-03-09 23:19:21 +01:00
parent d61db9e56e
commit 613c95486b

View File

@ -28,6 +28,7 @@
<div> <div>
<input type="hidden" name="classes_code" id="classes_code" value="{{ $classes_code }}" required> <input type="hidden" name="classes_code" id="classes_code" value="{{ $classes_code }}" required>
</div> </div>
<div> Stan połączenia z serwerem legitymacji: <span id="status" style="color:green"> połączony</span></div>
<div> <div>
<label for="student_id_number"> Nr indeksu: </label> <label for="student_id_number"> Nr indeksu: </label>
<input type="number" name="student_id_number" id="student_id_number" required> <input type="number" name="student_id_number" id="student_id_number" required>
@ -47,9 +48,12 @@
<script> <script>
var classes_code_input = $('#classes_code_input').html(); var classes_code_input = $('#classes_code_input').html();
const client = new WebSocket('wss://atcheck.projektstudencki.pl/wss', classes_code_input); const client = new WebSocket('wss://atcheck.projektstudencki.pl/wss', classes_code_input);
client.onclose = function(event) { client.onclose = function(event) {
console.log("WebSocket is closed now."); $('#status').innerHTML = " rozłączony";
$('#status').css("color", "red");
}; };
client.onmessage = function onmessage1(message) { client.onmessage = function onmessage1(message) {
message = JSON.parse(message.data); message = JSON.parse(message.data);
if (message.type = "data") { if (message.type = "data") {