2
0

login-salarie.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. $(document).ready(function() {
  2. $("#formLogin").submit(function(event) {
  3. if(checkconnection()){
  4. var formData = {
  5. ident: $("#ident").val(),
  6. date: $("#date").val(),
  7. from: $("#from").val(),
  8. event: $("#event").val()
  9. };
  10. $.ajax({
  11. type: "POST",
  12. url: "json.php?jsonData=login",
  13. data: formData
  14. }).done(function(data) {
  15. var json = $.parseJSON(data);
  16. if(!json.success) {
  17. $("#divAlerte").empty();
  18. $("#divAlerte").html('<div class="alert alert-danger alertLogin" role="alert">Erreur d\'authentification</div>');
  19. $("#divAlerte").show();
  20. window.setTimeout(function() {
  21. $("#divAlerte").fadeTo(600, 0).slideUp(600, function(){
  22. $(this).hide();
  23. $(this).css('opacity', '1');
  24. });
  25. }, 1000);
  26. } else {
  27. window.location = "/home.php";
  28. }
  29. });
  30. event.preventDefault();
  31. } else {
  32. event.preventDefault();
  33. $("#divAlerte").empty();
  34. $("#divAlerte").append('<div class="alert alert-warning alertLogin" role="alert">Vous n\'êtes pas connecté à internet</div>');
  35. $("#divAlerte").show();
  36. window.setTimeout(function() {
  37. $("#divAlerte").fadeTo(600, 0).slideUp(600, function(){
  38. $(this).hide();
  39. $(this).css('opacity', '1');
  40. });
  41. }, 1000);
  42. }
  43. })
  44. });