feature: ajout photo de profil
This commit is contained in:
@@ -16,27 +16,31 @@ const tableau_certificat = new Tabulator("#tableau-certificat", {
|
||||
],
|
||||
ajaxURL: url_certificat,
|
||||
})
|
||||
|
||||
const enregistrerProfil = $("enregistrerProfil");
|
||||
|
||||
enregistrerProfil.addEventListener("click", (e) => {
|
||||
|
||||
const url = $("information-personnelles").dataset.url;
|
||||
const csrftoken = document.querySelector("[name='csrfmiddlewaretoken']").value;
|
||||
|
||||
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);
|
||||
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrftoken
|
||||
"X-CSRFToken": csrftoken
|
||||
},
|
||||
body: JSON.stringify({
|
||||
"nom": $("nom").value,
|
||||
"prenom": $("prenom").value,
|
||||
"email": $("email").value,
|
||||
"telephone": $("telephone").value,
|
||||
"adresse": $("adresse").value,
|
||||
"sexe": $("sexe").value,
|
||||
"date_naissance": $("date_naissance").value,
|
||||
})
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => alert(data.message))
|
||||
})
|
||||
.catch(error => console.error("Erreur:", error));
|
||||
});
|
||||
Reference in New Issue
Block a user