$.ajax({
method: "POST",
dataType: "JSON",
data: { [input.name]: input.value },
url: G_SITE_URL + "index.php/profil/edit_" + input.name,
success: function (msg) {
if (msg.success == true) {
// Get the field name container and update the text
const fieldNameContainer = document.getElementById(element.dataset.fieldName);
fieldNameContainer.innerText = msg.display;
// Get the field container for hide the error inside
const fieldClassContainer = document.getElementsByClassName(element.dataset.fieldName)[0];
const inputError = fieldClassContainer.getElementsByClassName('input-error')[0];
inputError.style.display = "none";
} else {
// Get the field container for show an error inside
const fieldClassContainer = document.getElementsByClassName(element.dataset.fieldName)[0];
const inputError = fieldClassContainer.getElementsByClassName('input-error')[0];
inputError.style.display = "block";
}
}
});
Bonjour,
Pouvez vous m'aider pour convertir cette requête?