Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5. <meta charset="UTF-8">
  6. <title>Vérification de numéro de sécurité sociale</title>
  7. <script type="text/javascript" src="main.js"></script>
  8. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
  9. </head>
  10.  
  11. <body>
  12. <div style="text-align: center;">
  13. <input type="text" id="Ssn" placeholder="SSN">
  14. <input type="submit" id="submit" onclick="myFunction()">
  15. </div>
  16. <script>
  17. function myFunction() {
  18. document.getElementById("Info").innerHTML = "";
  19. var temp = document.getElementById("Ssn").value;
  20. var ssnValidator = new SsnValidator();
  21. var verif = ssnValidator.verificationSSN(temp);
  22. var ssn = new SSN();
  23. console.log(ssn.getBirthDpt(temp));
  24. var response;
  25. if (verif === true) {
  26. response = ssn.infoSSN(temp);
  27. $.ajax({ url: "https://geo.api.gouv.fr/departements/"+ssn.getBirthDpt(temp)+"?fields=nom"}).then(function(data)
  28. {
  29. $("#Info").append("<br>Traduction Departement :"+data['nom']);
  30. });
  31. $.ajax({ url: "https://geo.api.gouv.fr/communes/"+ssn.getBirthDpt(temp)+ssn.getBirthCity(temp)+"?fields=nom"}).then(function(data)
  32. {
  33. $("#Info").append("<br>Traduction Communes :"+data['nom']);
  34. });
  35. } else {
  36. response = "SSN invalide";
  37. }
  38.  
  39. $("#Info").append(response);
  40. }
  41.  
  42. </script>
  43. <div id="Info" style="text-align: center;">
  44. </div>
  45.  
  46.  
  47.  
  48. </body>
  49.  
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement