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

36 lines
778 B
JavaScript

const createBtn = document.getElementById("create-button");
const nameInput = document.getElementById("name-input");
createBtn.addEventListener("click", () => {
if (!correctData()) {
return;
}
if (!validate()) {
return;
}
});
const correctData = function () {
return true;
};
const validate = function () {
return true;
};
createBtn.addEventListener("click", () => {
let specializationModel = {
"Name": nameInput.value,
};
console.log(specializationModel)
$.ajax({
url: "/specializations/create",
type: "POST",
contentType: "application/json",
data: JSON.stringify(specializationModel)
}).done(() => {
window.location.href = "/Home/Specializations";
});
});