function deleteSchedule(event){
let scheduleID = $(event.target).parents("li").data("id");
$.ajax({
type : "DELETE",
url : "./calendar/removeSchedule",
data : {"id":scheduleID},
dateType : "json",
success : function(data){
console.log(event.target);
$(event.target).parents("li").remove();
$(".block_schedule").each(function(){
if($(this).data("year") === data.year && $(this).data("month") === data.month && $(this).data("date") === data.date){
let text = "";
if(data.schedules){
data.schedules.slice(0,3).forEach(function(value){
if(value.length<=12){
text=text+value+" ";
}
else{
text=text+value.substr(0, 13)+".. "
}
});
if(data.schedules.length>3){
text += "\n..."
}
}
$(this).text(text);
return false;
}
})
},
error : function(xhr){
console.log(xhr.responseText);
},
});
}
내가짠 코드지만 진짜 근본 없는 가독성인거같다
최소한 들여쓰기는 해줘야
일단 jquery를 버리고 vuejs하면 된다
여러 줄로 나누지 말고 한줄로 만들어라 그래야 책읽듯이 읽을 수 있고 실력이 좋아진다