2023-05-20 04:14:14 +04:00
|
|
|
|
const updateBtn = document.getElementById("update-button");
|
2023-05-18 23:42:48 +04:00
|
|
|
|
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({
|
2023-05-19 13:20:14 +04:00
|
|
|
|
url: "/specializations/update",
|
2023-05-18 23:42:48 +04:00
|
|
|
|
type: "POST",
|
|
|
|
|
contentType: "application/json",
|
|
|
|
|
data: JSON.stringify(specialization)
|
|
|
|
|
}).done(() => {
|
|
|
|
|
window.location.href = "/Home/Specializations";
|
|
|
|
|
});
|
|
|
|
|
});
|