Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>Vérification de numéro de sécurité sociale</title>
- <script type="text/javascript" src="main.js"></script>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
- </head>
- <body>
- <div style="text-align: center;">
- <input type="text" id="Ssn" placeholder="SSN">
- <input type="submit" id="submit" onclick="myFunction()">
- </div>
- <script>
- function myFunction() {
- document.getElementById("Info").innerHTML = "";
- var temp = document.getElementById("Ssn").value;
- var ssnValidator = new SsnValidator();
- var verif = ssnValidator.verificationSSN(temp);
- var ssn = new SSN();
- console.log(ssn.getBirthDpt(temp));
- var response;
- if (verif === true) {
- response = ssn.infoSSN(temp);
- $.ajax({ url: "https://geo.api.gouv.fr/departements/"+ssn.getBirthDpt(temp)+"?fields=nom"}).then(function(data)
- {
- $("#Info").append("<br>Traduction Departement :"+data['nom']);
- });
- $.ajax({ url: "https://geo.api.gouv.fr/communes/"+ssn.getBirthDpt(temp)+ssn.getBirthCity(temp)+"?fields=nom"}).then(function(data)
- {
- $("#Info").append("<br>Traduction Communes :"+data['nom']);
- });
- } else {
- response = "SSN invalide";
- }
- $("#Info").append(response);
- }
- </script>
- <div id="Info" style="text-align: center;">
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement