Correction enregistrement profil
Some checks failed
Organisation/sirh/pipeline/head There was a failure building this commit
Some checks failed
Organisation/sirh/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -18,29 +18,34 @@ const tableau_certificat = new Tabulator("#tableau-certificat", {
|
||||
})
|
||||
const enregistrerProfil = $("enregistrerProfil");
|
||||
|
||||
enregistrerProfil.addEventListener("click", (e) => {
|
||||
// enregistrerProfil.addEventListener("click", (e) => {
|
||||
|
||||
const url = $("information-personnelles").dataset.url;
|
||||
const csrftoken = document.querySelector("[name='csrfmiddlewaretoken']").value;
|
||||
// const url = $("information-personnelles").dataset.url;
|
||||
// const csrftoken = document.querySelector("[name='csrfmiddlewaretoken']").value;
|
||||
|
||||
const formData = new FormData();
|
||||
// const formData = new FormData();
|
||||
|
||||
formData.append("nom", $("nom").value);
|
||||
formData.append("prenom", $("prenom").value);
|
||||
formData.append("email", $("email").value);
|
||||
formData.append("telephone", $("telephone").value);
|
||||
formData.append("adresse", $("adresse").value);
|
||||
formData.append("sexe", $("sexe").value);
|
||||
formData.append("date_naissance", $("date_naissance").value);
|
||||
// formData.append("nom", $("nom").value);
|
||||
// formData.append("prenom", $("prenom").value);
|
||||
// formData.append("email", $("email").value);
|
||||
// formData.append("telephone", $("telephone").value);
|
||||
// formData.append("adresse", $("adresse").value);
|
||||
// formData.append("sexe", $("sexe").value);
|
||||
// formData.append("date_naissance", $("date_naissance").value);
|
||||
|
||||
fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-CSRFToken": csrftoken
|
||||
},
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => alert(data.message))
|
||||
.catch(error => console.error("Erreur:", error));
|
||||
});
|
||||
|
||||
// console.log("---------------------------------------------")
|
||||
// console.log("Données du formulaire:", url);
|
||||
// console.log("Données du formulaire:", formData);
|
||||
|
||||
// fetch(url, {
|
||||
// method: "POST",
|
||||
// headers: {
|
||||
// "X-CSRFToken": csrftoken
|
||||
// },
|
||||
// body: formData
|
||||
// })
|
||||
// .then(response => response.json())
|
||||
// .then(data => alert(data.message))
|
||||
// .catch(error => console.error("Erreur:", error));
|
||||
// });
|
||||
Reference in New Issue
Block a user