Case_accounting/CaseAccounting/CaseAccountingCustomerView/wwwroot/js/Specializations/specialization-update.js

38 lines
874 B
JavaScript

const updateBtn = document.getElementById("update-button");
const nameInput = document.getElementById("name-input")
const specializationId = document.getElementById("spec-id").dataset.id
updateBtn.addEventListener("click", () => {
if (!correctData()) {
return;
}
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
};
const validate = function () {
return true;
};
updateBtn.addEventListener("click", () => {
let specialization = {
"Id": parseInt(specializationId),
"Name": nameInput.value,
};
console.log(specialization)
$.ajax({
url: "/specialization/update",
type: "POST",
contentType: "application/json",
data: JSON.stringify(specialization)
}).done(() => {
window.location.href = "/Home/Specializations";
});
});