38 lines
875 B
JavaScript
38 lines
875 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: "/specializations/update",
|
|
type: "POST",
|
|
contentType: "application/json",
|
|
data: JSON.stringify(specialization)
|
|
}).done(() => {
|
|
window.location.href = "/Home/Specializations";
|
|
});
|
|
}); |