z9inn
26
2021-01-21 20:19:50 작성 2021-01-21 20:24:40 수정됨
5
188

스크립트 오류가 뜨는데 뭐가 문젠지 알고싶습니다


일단 제가 게시판의 댓글을 구현하던 도중 문제가 발생했는데요

일단 이러한 오류가 뜨구요

$(document).ready(function()함수를 안써줘서 그런가해서 함수쓰고 안에 내용을 채워넣어도 똑같이 에러가 뜹니다

사진 보면 지금은 빨간줄이 뜨지만 함수안에 내용을 쓰면 빨간줄은 사라지나 오류는 같습니다

뭘 쓰지 않아서 이러한 오류가 뜨는건지 알고 싶습니다

댓글구현은 전에 스프링 책으로 한번 구현했던것을 필요한부분만 가져와서 수정했습니다

전에 적었던 내용도 함께 첨부하겠습니다

뭐가 문제인지 알고싶습니다


Ctrl + F 누르시고 var questionNoValue 이거 검색하시면 내용 찾기 쉬울것 같습니다






지금 구현하고 있는 get.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<%@ include file="../includes/header.jsp"%>
<div class="row">
	<div class="col-lg-12">
		<h1 class="page-header">Q&A</h1>
	</div>
</div>
<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
			<div class="panel-heading">Q&A</div>
<!-- 			Q&A 상세보기 -->
<!-- 화면에 보이는 부분 -->
			<div class="form-group">
				<label>제목</label><input class="form-control" name='title' value='<c:out value="${qna.title }"/>' readonly="readonly">
			</div>
			<div class="form-group">
				<label>작성자</label><input class="form-control" name='writer' value='<c:out value="${qna.writer }"/>' readonly="readonly">
			</div>
			<div class="form-group">
				<label>내용</label><textarea class="form-control" rows="3" name='content' readonly="readonly"><c:out value="${qna.content }"/></textarea>
			</div>
			<button data-oper='modify' class="btn bnt-default" onclick="location.href='/qna/modify?questionNo=<c:out value="${qna.questionNo }"/>'">Modify</button>
			<button data-oper='list' class="btn bnt-default" onclick="location.href='/qna/list'">List</button>
			<form action="/qna/modify" id="operForm" method="get">
				<input type="hidden" id="questionNo" name="questionNo" value='<c:out value="${qna.questionNo }"/>'>
				<input type='hidden' name='pageNum' value='<c:out value="${cri.pageNum}"/>'>
				<input type='hidden' name='amount' value='<c:out value="${cri.amount}"/>'>
				<input type='hidden' name='keyword' value='<c:out value="${cri.keyword}"/>'>
				<input type='hidden' name='type' value='<c:out value="${cri.type}"/>'>
			</form>
		</div>
	</div>
</div>

<!-- 댓글창 -->
<div class='row'>

<div class="col-lg-12">
	<!-- /.pannel -->
	<div class="panel panel-default">		
					
<!-- 						<div class="panel-heading"> -->
<!-- 							<i class="fa fa-comments fa-fw"></i> Reply -->
<!-- 						</div> -->

						<div class="panel-heading">
							<i class="fa fa-comments fa-fw"></i> Q&A 답변
							<button id="addReplyBtn" class='btn btn-primary btn-xs pull-right'>Q&A 답변달기</button>
						</div>
						
						<div class="panel-body">
						<ul class="chat">
							<li class="left clearfix" data-rno='12'>
							<div>
								<div class="header">
									
								</div>
							</div>
							</li>
							<!-- end reply -->
						</ul>
						<!-- ./ end ul -->
						</div>
						<!-- /.panel .chat-panel 439p-->
						<div class="panel-footer">
						
						</div>
						<!-- ./end panel-default -->
					</div>
					<!-- ./end col-lg-12 -->
				</div>
				<!-- ./end row -->
			</div>
			

<!-- Modal -->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title" id="myModalLabel">REPLY MODAL</h4>
					</div>
					
					<div class="modal-body">
						<div class="form-group">
						<label>Reply</label>
						<input class="form-control" name='reply' value='New Reply!!!!'>
						</div>
						<div class="form-group">
						<label>Replyer</label>
						<input class="form-control" name='replyer' value='replyer'>
						</div>
						<div class="form-group">
						<label>Reply Date</label>
						<input class="form-control" name='replyDate' value=''>
						</div>
					</div>
				<div class="modal-footer">
					<button id='modalModBtn' type="button" class="btn btn-warning">Modify</button>
					<button id='modalRemoveBtn' type="button" class="btn btn-danger">Remove</button>
					<button id='modalRegisterBtn' type="button" class="btn btn-success" data-dismiss='modal'>Register</button>
					<button id='modalCloseBtn' type="button" class="btn btn-default" data-dismiss='modal'>Close</button>
				</div>
				
				</div>
<!-- 				/.modal-content -->
			</div>
<!-- 			/.modal-dialog -->
		</div>
<!-- 		/.modal -->


			<script type="text/javascript" src="/resources/js/reply.js"></script>
			<script type="text/javascript">
			console.log("=================");
			console.log("JS TEST");
			
			var questionNoValue = '<c:out value= "${qna.questionNo}"/>';
			var replyUL = $(".chat");
			
			showList(1);
			
			function showList(page){
				console.log("show list " + page);
				QaReplyService.getList({questionNo:questionNoValue,page: page|| 1}, function(replyCnt, list){
					
					console.log("replyCnt: " + replyCnt);
					console.log("list: " + list);
					console.log(list);
					
					if(page == -1){//마지막 페이지를 찾아서 다시 호출
						pageNum = Math.ceil(replyCnt / 10.0);
						showList(pageNum);
						return;
					}
					
					var str = "";
					if(list == null || list.length == 0){
						
						return;
					}
					for (var i = 0, len = list.length || 0; i < len; i++){
						str +="<li class= 'left clearfix' data-rno='"+list[i].rno+"'>";
						str +=" <div><div class='header'><strong class='primary-font'>"+list[i].replyer+"</strong>";
						str +=" <small class='pull-right text-muted'>"+QaReplyService.displayTime(list[i].replyDate)+"</small></div>";
						str +=" <p>"+list[i].reply+"</p></div></li>";
					}
					replyUL.html(str);
					
					showReplyPage(replyCnt);
				});//end function
			}//end show List
			
			//440
			var pageNum = 1;
			var replyPageFooter = $(".panel-footer");
			
			function showReplyPage(replyCnt) {


				var endNum = Math.ceil(pageNum / 10.0) * 10;
				var startNum = endNum - 9;
				
				var prev = startNum != 1;
				var next = false;
				
				if (endNum * 10 >= replyCnt) {
					endNum = Math.ceil(replyCnt/10.0);
				}

				if (endNum * 10 < replyCnt) {
					next = true;
				}
				
				var str = "<ul class='pagination pull-right'>";
				
				if(prev){
					str += "<li class='page-item'><a class ='page-link' href='"+(startNum -1)+"'>Previous</a></li> ";
				}
				
				for(var i = startNum ; i <= endNum; i++) {
					var active = pageNum == i? "active":"";
					str += "<li class='page-item "+active+" '><a class='page-link' href='"+i+"'>"+i+"</a></li>";
				}
				
				if(next){
					str += "<li class='page-item'><a class='page-link' href='"+(endNum + 1)+"'>Next</a></li> ";
				}
				str += "</ul></div>";
				
				console.log(str);
				
				replyPageFooter.html(str);
				
			}
			
			//modal function
			var modal = $(".modal");
	var modalInputReply = modal.find("input[name='reply']");
	var modalInputReplyer = modal.find("input[name='replyer']");
	var modalInputReplyDate = modal.find("input[name='replyDate']");
	
	var modalModBtn = $("#modalModBtn");
	var modalRemoveBtn = $("#modalRemoveBtn");
	var modalRegisterBtn = $("#modalRegisterBtn");
	
	$("#addReplyBtn").on("click", function(e) {
		modal.find("input").val("");
		modalInputReplyDate.closest("div").hide();
		modal.find("button[id != 'modalCloseBtn']").hide();
		
		modalRegisterBtn.show();
		
		$(".modal").modal("show");
	});
	//댓글 등록 및 목록 갱신
	modalRegisterBtn.on("click",function(e){
		var reply = {
				reply: modalInputReply.val(),
				replyer: modalInputReplyer.val(),
				questionNo: questionNoValue
		};
		QaReplyService.add(reply, function(result){
			alert(result);
			
			modal.find("input").val("");
			modal.modal("hide");
			
			//showList(1) //수정 후 댓글목록 갱신
			showList(-1) // page번호가 -1로 전달되면 마지막페이지를 다시 찾아서 호출 >> 전체댓글 숫자 파악 >> 마지막페이지 호출
		});
	});
	
	//댓글 조회 처리
	$(".chat").on("click", "li", function(e){
		var rno = $(this).data("rno");
		QaReplyService.get(rno, function(reply){
			modalInputReply.val(reply.reply);
			modalInputReplyer.val(reply.replyer);
			modalInputReplyDate.val(QaReplyService.displayTime(reply.replyDate)).attr("readonly","readeonly");
			modal.data("rno", reply.rno);
			
			modal.find("button[id != 'modalCloseBtn']").hide();
			modalModBtn.show();
			modalRemoveBtn.show();
			
			$(".modal").modal("show");
		});
		console.log(rno);
	});
	
	//댓글 수정
	modalModBtn.on("click", function(e){
		var reply = {rno:modal.data("rno"), reply: modalInputReply.val()};
		QaReplyService.update(reply, function(result){
			
			alert(result);
			modal.modal("hide");
			showList(pageNum);
		});	
	});
	
	
	//댓글 삭제
	modalRemoveBtn.on("click", function(e){
		var rno = modal.data("rno");
		QaReplyService.remove(rno, function(result){
			
			alert(result);
			modal.modal("hide");
			showList(pageNum);
		});
	});
	
	//댓글 페이징처리
	replyPageFooter.on("click","li a", function(e){
		e.preventDefault();
		console.log("page click");
		
		var targetPageNum = $(this).attr("href");
		console.log("targetPageNum: " + targetPageNum);
		
		pageNum = targetPageNum;
		
		showList(pageNum);
	});
	</script>

<script type="text/javascript">
$(document).ready(function(){
	
	var operForm = $("#operForm");
	
	$("button[data-oper = 'modify']").on("click",function(e){
		operForm.attr("action","/qna/modify").submit();
	});
	$("button[data-oper = 'list']").on("click",function(e){
		operForm.find("questionNo").remove();
		operForm.attr("action","/qna/list")
		operForm.submit();
	});
	
});
</script>

<%@ include file="../includes/footer.jsp"%>


전에 작성했던 get.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>    
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>    
    
<%@ include file="../includes/header.jsp" %>

<div class="row">
	<div class="col-lg-12">
		<h1 class="page-header">Board Read</h1>
	</div>
</div>

<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
		
			<div class="panel-heading">Board Read Page</div>
			<div class="panel-body">
			
<!-- 	252		 -->

			<div class="form-group">
			<label>Bno</label> <input class="form-control" name='bno' value='<c:out value="${board.bno }"/>' readonly="readonly">
			</div>
			
			<div class="form-group">
			<label>Title</label> <input class="form-control" name='title' value='<c:out value="${board.title }"/>' readonly="readonly">
			</div>
			
			<div class="form-group">
			<label>Text area</label> 
			<textarea class="form-control" rows="3"  name='content' readonly="readonly"><c:out value="${board.content }"/></textarea>
			</div>
			
			<div class="form-group">
			<label>Writer</label> <input class="form-control" name='writer' value='<c:out value="${board.writer }"/>' readonly="readonly">
			</div>
<!-- 254p				 -->
			<button data-oper='modify'
			 class="btn btn-default" 
			onclick="location.href='/board/modify?bno=<c:out value="${board.bno }"/>'">Modify</button>
			<button data-oper='list' class="btn btn-info" onclick="location.href='/board/list'">List</button>
<!-- 264			 -->
			<form id="operForm" action="/board/modify" method="get">
				<input type='hidden' id='bno' name='bno' value='<c:out value="${board.bno }"/>'>
				<input type='hidden' name='pageNum' value='<c:out value="${cri.pageNum}"/>'>
				<input type='hidden' name='amount' value='<c:out value="${cri.amount}"/>'>
				<input type='hidden' name='keyword' value='<c:out value="${cri.keyword}"/>'>
				<input type='hidden' name='type' value='<c:out value="${cri.type}"/>'>
			</form>
<!-- 265			 -->
		  </div>
             <!-- end panel-body -->
        </div>
          <!-- end panel-body -->
   </div>
       <!-- end panel -->
</div>
<!-- /.row -->

<div class="bigPictureWrapper">
	<div class="bigPicture">
	</div>
</div>

<style>
.uploadResult{
width: 100%;
background-color: gray;
}

.uploadResult ul{
display: flex;
flex-flow: row;
justify-content: center;
align-items: center;
}

.uploadResult ul li{
list-style: none;
padding: 10px;
align-content: center;
text-align: center;
}

.uploadResult ul li img{
width: 100px;
}

.uploadResult ul li span{
color: white;
}

.bigPictureWrapper{
position: absolute;
display: none;
justify-content: center;
align-items: center;
top: 0%;
width: 100%;
height: 100%;
background-color: gray;
z-index: 100;
background: rgba(255,255,255,0.5);
}

.bigPicture{
position: relative;
display: flex;
justify-content: center;
align-items: center;
}

.bigPicture img{
width: 600px;
}
</style>

<div class="row">
	<div class="col-lg-12">
		<div class="panel panel-default">
		
			<div class="panel-heading">Files</div>
			<!-- /.panel-heading -->
			<div class="panel-body">
			
				<div class="uploadResult">
					<ul>
					</ul>
				</div>
			</div>
			<!-- end panel-body -->
		</div>
		<!-- end panel-body -->
	</div>
	<!-- end panel -->
</div>
<!-- /.row -->
			
			<!-- 댓글창 -->
<div class='row'>

<div class="col-lg-12">
	<!-- /.pannel -->
	<div class="panel panel-default">		
					
<!-- 						<div class="panel-heading"> -->
<!-- 							<i class="fa fa-comments fa-fw"></i> Reply -->
<!-- 						</div> -->

						<div class="panel-heading">
							<i class="fa fa-comments fa-fw"></i> Reply
							<button id="addReplyBtn" class='btn btn-primary btn-xs pull-right'>New Reply</button>
						</div>
						
						<div class="panel-body">
						<ul class="chat">
							<li class="left clearfix" data-rno='12'>
							<div>
								<div class="header">
									<strong class="primary-font">user00</strong>
									<small class="pull-right text-muted">2020-12-21 14:40</small>
								</div>
								<p>Good Job!</p>
							</div>
							</li>
							<!-- end reply -->
						</ul>
						<!-- ./ end ul -->
						</div>
						<!-- /.panel .chat-panel 439p-->
						<div class="panel-footer">
						
						</div>
						<!-- ./end panel-default -->
					</div>
					<!-- ./end col-lg-12 -->
				</div>
				<!-- ./end row -->
			</div>
			

<!-- Modal -->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title" id="myModalLabel">REPLY MODAL</h4>
					</div>
					
					<div class="modal-body">
						<div class="form-group">
						<label>Reply</label>
						<input class="form-control" name='reply' value='New Reply!!!!'>
						</div>
						<div class="form-group">
						<label>Replyer</label>
						<input class="form-control" name='replyer' value='replyer'>
						</div>
						<div class="form-group">
						<label>Reply Date</label>
						<input class="form-control" name='replyDate' value=''>
						</div>
					</div>
				<div class="modal-footer">
					<button id='modalModBtn' type="button" class="btn btn-warning">Modify</button>
					<button id='modalRemoveBtn' type="button" class="btn btn-danger">Remove</button>
					<button id='modalRegisterBtn' type="button" class="btn btn-success" data-dismiss='modal'>Register</button>
					<button id='modalCloseBtn' type="button" class="btn btn-default" data-dismiss='modal'>Close</button>
				</div>
				
				</div>
<!-- 				/.modal-content -->
			</div>
<!-- 			/.modal-dialog -->
		</div>
<!-- 		/.modal -->


			<script type="text/javascript" src="/resources/js/reply.js"></script>
			<script type="text/javascript">
			console.log("=================");
			console.log("JS TEST");
			
			var bnoValue = '<c:out value= "${board.bno}"/>';
			var replyUL = $(".chat");
			
			showList(1);
			
			function showList(page){
				console.log("show list " + page);
				replyService.getList({bno:bnoValue,page: page|| 1}, function(replyCnt, list){
					
					console.log("replyCnt: " + replyCnt);
					console.log("list: " + list);
					console.log(list);
					
					if(page == -1){
						pageNum = Math.ceil(replyCnt / 10.0);
						showList(pageNum);
						return;
					}
					
					var str = "";
					if(list == null || list.length == 0){
						replyUL.html("");
						
						return;
					}
					for (var i = 0, len = list.length || 0; i < len; i++){
						str +="<li class= 'left clearfix' data-rno='"+list[i].rno+"'>";
						str +=" <div><div class='header'><strong class='primary-font'>"+list[i].replyer+"</strong>";
						str +=" <small class='pull-right text-muted'>"+replyService.displayTime(list[i].replyDate)+"</small></div>";
						str +=" <p>"+list[i].reply+"</p></div></li>";
					}
					replyUL.html(str);
					
					showReplyPage(replyCnt);
				});//end function
			}//end show List
			
			//440
			var pageNum = 1;
			var replyPageFooter = $(".panel-footer");
			
			function showReplyPage(replyCnt) {


				var endNum = Math.ceil(pageNum / 10.0) * 10;
				var startNum = endNum - 9;
				
				var prev = startNum != 1;
				var next = false;
				
				if (endNum * 10 >= replyCnt) {
					endNum = Math.ceil(replyCnt/10.0);
				}

				if (endNum * 10 < replyCnt) {
					next = true;
				}
				
				var str = "<ul class='pagination pull-right'>";
				
				if(prev){
					str += "<li class='page-item'><a class ='page-link' href='"+(startNum -1)+"'>Previous</a></li> ";
				}
				
				for(var i = startNum ; i <= endNum; i++) {
					var active = pageNum == i? "active":"";
					str += "<li class='page-item "+active+" '><a class='page-link' href='"+i+"'>"+i+"</a></li>";
				}
				
				if(next){
					str += "<li class='page-item'><a class='page-link' href='"+(endNum + 1)+"'>Next</a></li> ";
				}
				str += "</ul></div>";
				
				console.log(str);
				
				replyPageFooter.html(str);
				
			}
			
			//modal function
			var modal = $(".modal");
	var modalInputReply = modal.find("input[name='reply']");
	var modalInputReplyer = modal.find("input[name='replyer']");
	var modalInputReplyDate = modal.find("input[name='replyDate']");
	
	var modalModBtn = $("#modalModBtn");
	var modalRemoveBtn = $("#modalRemoveBtn");
	var modalRegisterBtn = $("#modalRegisterBtn");
	
	$("#addReplyBtn").on("click", function(e) {
		modal.find("input").val("");
		modalInputReplyDate.closest("div").hide();
		modal.find("button[id != 'modalCloseBtn']").hide();
		
		modalRegisterBtn.show();
		
		$(".modal").modal("show");
	});
	//댓글 등록 및 목록 갱신
	modalRegisterBtn.on("click",function(e){
		var reply = {
				reply: modalInputReply.val(),
				replyer: modalInputReplyer.val(),
				bno: bnoValue
		};
		replyService.add(reply, function(result){
			alert(result);
			
			modal.find("input").val("");
			modal.modal("hide");
			
			//showList(1) //수정 후 댓글목록 갱신
			showList(-1) // page번호가 -1로 전달되면 마지막페이지를 다시 찾아서 호출 >> 전체댓글 숫자 파악 >> 마지막페이지 호출
		});
	});
	
	//댓글 조회 처리
	$(".chat").on("click", "li", function(e){
		var rno = $(this).data("rno");
		replyService.get(rno, function(reply){
			modalInputReply.val(reply.reply);
			modalInputReplyer.val(reply.replyer);
			modalInputReplyDate.val(replyService.displayTime(reply.replyDate)).attr("readonly","readeonly");
			modal.data("rno", reply.rno);
			
			modal.find("button[id != 'modalCloseBtn']").hide();
			modalModBtn.show();
			modalRemoveBtn.show();
			
			$(".modal").modal("show");
		});
		console.log(rno);
	});
	
	//댓글 수정
	modalModBtn.on("click", function(e){
		var reply = {rno:modal.data("rno"), reply: modalInputReply.val()};
		replyService.update(reply, function(result){
			
			alert(result);
			modal.modal("hide");
			showList(pageNum);
		});	
	});
	
	
	//댓글 삭제
	modalRemoveBtn.on("click", function(e){
		var rno = modal.data("rno");
		replyService.remove(rno, function(result){
			
			alert(result);
			modal.modal("hide");
			showList(pageNum);
		});
	});
	
	//댓글 페이징처리
	replyPageFooter.on("click","li a", function(e){
		e.preventDefault();
		console.log("page click");
		
		var targetPageNum = $(this).attr("href");
		console.log("targetPageNum: " + targetPageNum);
		
		pageNum = targetPageNum;
		
		showList(pageNum);
	});
			
			//form replyService add test
// 			replyService.add(
// 					{reply:"JS Test", replyer:"tester", bno:bnoValue}
// 					,
// 					function(result){
// 						alert("RESULT: " + result);
// 					});
			
			//reply List Test
			replyService.getList({bno:bnoValue, page:1}, function(list){
				for(var i = 0, len = list.length||0; i < len; i++){
					console.log(list[i]);
				}
			});
			// 댓글 삭제 테스트
// 			replyService.remove(43, function(count){
// 				console.log(count);
				
// 				if(count === "success"){
// 					alert("REMOVED");
// 				}
// 			}, function(err){
// 				alert('ERROR....');
// 			});
			//댓글 수정
// 			replyService.update({
// 				rno : 30,
// 				bno : bnoValue,
// 				reply : "Modified Reply........"
// 			}, function(result){
// 				alert("수정 완료...");
// 			});
// 			replyService.get(10, function(data){
// 				console.log(data);
// 			});
			</script>
			
			<script type="text/javascript">

			$(document).ready(function(){
				console.log(replyService);
				var operForm = $("#operForm");
				$("button[data-oper='modify']").on("click",function(e){
					operForm.attr("action","/board/modify").submit();
				});
				
				$("button[data-oper='list']").on("click",function(e){
					
					operForm.find("#bno").remove();
					operForm.attr("action","/board/list")
					operForm.submit();
				});
			});
			</script>
			
			<script>
			$(document).ready(function(){
				(function(){
					var bno = '<c:out value="${board.bno}"/>';
					$.getJSON("/board/getAttachList", {bno: bno}, function(arr){
						console.log(arr);
						//574
						var str = "";
						
						$(arr).each(function(i, attach){
							
							//image type
							if(attach.fileType){
								var fileCallPath = encodeURIComponent(attach.uploadPath+ "/s_"+attach.uuid + "_" + attach.fileName);
								
								str += "<li data-path='"+attach.uploadPath+"' data-uuid='"+attach.uuid+"' data-filename='"+attach.fileName+"' data-type='"+attach.fileType+"' ><div>";
								str += "<img src='/display?fileName="+fileCallPath+"'>";
								str += "</div>";
								str +"</li>";
								
							}else{
								
								str += "<li data-path='"+attach.uploadPath+"' data-uuid='"+attach.uuid+"' data-filename='"+attach.fileName+"' data-type='"+attach.fileType+"' ><div>";
								str += "<span> " + attach.fileName +"</span><br/>";
								str += "<img src='/resources/img/attach.png'>";
								str += "</div>";
								str +"</li>";
								
							}
						});
						
						$(".uploadResult ul").html(str);
						
					}); //end getjson
				})();//end function
				
				$(".uploadResult").on("click","li",function(e){
					
					console.log("view image");
					
					var liObj = $(this);
					
					var path = encodeURIComponent(liObj.data("path")+"/" + liObj.data("uuid")+"_" + liObj.data("filename"));
					
					if(liObj.data("type")){
						showImage(path.replace(new RegExp(/\\/g),"/"));
					}else{
						//download
						self.location = "/download?fileName="+path
					}
				});
				
				function showImage(fileCallPath){
					
					alert(fileCallPath);
					
					$(".bigPictureWrapper").css("display","flex").show();
					
					$(".bigPicture").html("<img src='/display?fileName="+fileCallPath+"'>").animate({width: '100%',height: '100%'}, 1000);
				}
				$(".bigPictureWrapper").on("click", function(e) {
					$(".bigPicture").animate({width: '0%', height: '0%'}, 1000);
					setTimeout(function(){
						$('.bigPictureWrapper').hide();
					}, 1000);
				});
			});
			</script>

<%@ include file="../includes/footer.jsp" %>


-1
0
  • 답변 5

  • agramar
    85
    2021-01-21 21:07:47

    reply.js 에 QaReplyService 선언되어있나요?

    만약 선언되어있는데도 그런거라면 브라우저 캐시때문에 reply.js 파일이 기존 버전을 불러온거 같습니다. 

  • 초보자1212
    2k
    2021-01-21 21:43:29

    개인적으로 이런류의 질문은 너무 별로네요

    양도 많은데 읽는 사람 최소한의 배려로 코드 포맷팅도 안되어있고

    오류 대충 찍어서 올리고 코드 대충 다 긁어서 올리고

    알아서 코드도 해석해서 오류 원인 찾아서 나한테 알려달라 라고하는 전형적인 무성의 질문 느낌이 강해서

  • 초보자1212
    2k
    2021-01-21 21:44:17

    지난 글도 보니 이렇게 질문하시는게 습관이신 듯 하네요

    q&a 게시판 공지사항을 꼭 읽어보시길 추천합니다

  • z9inn
    26
    2021-01-21 21:59:30 작성 2021-01-21 22:03:24 수정됨

    @초보자1212

    그렇게 느끼셨다면 죄송합니다.....

    저는 다른뜻은 없었습니다

    코딩을 시작한지 얼마 되지않아 돌아가는 시스템도 사실 아직 숙지가 잘안되어있습니다

    저도 어디가 문제인지 알았다면 그 부분만 찾아서 올렸을텐데

    어디가 어떻게 문제인지 잘모르겠어서 이런식으로 올리게 된점 사과드리겠습니다

    한참 고민하고 오류메시지 구글에 검색도 해보고 의심가는곳 수정도 해보고 다 해보았는데

    저 혼자 찾기는 너무 버거워서 저도 하도 답답해서 질문을 올렸습니다

    불편하게 해드린점 거듭 죄송합니다


  • z9inn
    26
    2021-01-21 22:08:16

    @argramar


    reply.js에 QaReplyService를 선언해야 하는건가요?

    책에는 따로 reply.js에 ReplyService를 선언하지 않아서

    따로 선언하지 않은것 같습니다

    선언해야한다면  var QaReplyService = function(){내용} 이런식으로 선언하면 될까요?

  • 로그인을 하시면 답변을 등록할 수 있습니다.