/
client.js
35 lines (31 loc) · 1.02 KB
/
client.js
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
function search(name) {
if(event.keyCode == 13) {
jQuery.ajax({
url: "http://localhost:3000/verifyUser",
type: "GET",
data: {
"un": name.value,
},
})
.done(function(data) {
if(data == "True") {
window.location.href = "/choose.html?username=" + name.value;
}
else {
var snackbarContainer = document.querySelector('#demo-snackbar-example');
var showSnackbarButton = document.querySelector('#demo-show-snackbar');
var handler = function(event) {
showSnackbarButton.style.backgroundColor = '';
};
showSnackbarButton.style.backgroundColor = '#' +
Math.floor(Math.random() * 0xFFFFFF).toString(16);
var data = {
timeout: 2000,
actionHandler: handler,
actionText: 'Undo'
};
snackbarContainer.MaterialSnackbar.showSnackbar(data);
}
})
}
}