FAISP/src/main/resources/static/js/equip/equip.js

60 lines
1.3 KiB
JavaScript

$(document).on('click', '#addEquip', function (){
$.ajax({
url: '/equip/equipEditModal',
type: 'GET',
dataType:"html",
success: function(html){
$("#equipEditModalContent").empty().append(html)
$("#equipEditModal").modal('show')
},
error:function(){
}
});
})
$(document).on('change', '#equType', function (){
const equType = $(this).val();
$.ajax({
url: '/equip/equipTypeSelecBox',
data: {
equType,
},
type: 'GET',
dataType:"html",
success: function(html){
console.log(html);
$("#detailType").empty().append(html)
},
error:function(){
}
});
$(document).on('click', '#saveEquip', function (){
if(confirm("저장하시겠습니까?")){
let ajaxUrl = "/equip/saveEquip";
const formData = new FormData($("#equipEditForm")[0]);
contentFade("in");
$.ajax({
type : 'POST',
data : formData,
url : ajaxUrl,
processData: false,
contentType: false,
success : function() {
alert("저장되었습니다.");
location.reload();
contentFade("out");
},
error : function(xhr, status) {
alert("저장에 실패하였습니다.")
contentFade("out");
}
})
}
})
});