-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
50 lines (46 loc) · 1.11 KB
/
index.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'use strict';
$(document).ready(function() {
$("#register2").click(registerShow);
$("#register").click(register);
$("#login2").click(loginShow);
$("#login").click(login);
//$("#loginForm").show();
});
var registerShow = function() {
//$("#loginForm").hide();
//$("#registerForm").show();
$('.flip-container').toggleClass('hover');
},
loginShow = function() {
//$("#loginForm").show();
//$("#registerForm").hide();
$('.flip-container').toggleClass('hover');
},
register = function() {
$.ajax({
type: 'post',
url: 'services/register.php',
data: $("#registerForm").serialize(),
success: function(data){
console.debug('chiamato');
alert(data);
},
dataType: 'json'
});
},
login = function() {
$.ajax({
type: 'post',
url: 'login.php',
data: $("#loginForm").serialize(),
success: function(data){
if (data.login === true) {
$('.flip-container').toggleClass('login');
setTimeout(function(){document.location.href = data.url;}, 500);
} else {
$('#message').html(data.msg).show();
}
},
dataType: 'json'
});
};