$(document).ready(function() {
$("#formLogin").submit(function(event) {
if(checkconnection()){
var formData = {
ident: $("#ident").val(),
date: $("#date").val(),
from: $("#from").val(),
event: $("#event").val()
};
$.ajax({
type: "POST",
url: "json.php?jsonData=login",
data: formData
}).done(function(data) {
var json = $.parseJSON(data);
if(!json.success) {
$("#divAlerte").empty();
$("#divAlerte").html('
Erreur d\'authentification
');
$("#divAlerte").show();
window.setTimeout(function() {
$("#divAlerte").fadeTo(600, 0).slideUp(600, function(){
$(this).hide();
$(this).css('opacity', '1');
});
}, 1000);
} else {
window.location = "/home.php";
}
});
event.preventDefault();
} else {
event.preventDefault();
$("#divAlerte").empty();
$("#divAlerte").append('Vous n\'êtes pas connecté à internet
');
$("#divAlerte").show();
window.setTimeout(function() {
$("#divAlerte").fadeTo(600, 0).slideUp(600, function(){
$(this).hide();
$(this).css('opacity', '1');
});
}, 1000);
}
})
});