카테고리 없음 ajax - <script type="text/javascript"> $(document).ready(function (){ $("input[name='buttonSubmit']").click(function() { // 제출 버튼 이벤트 지정 console.log('ajax실행'); <%-- <% --%> // if(id == null){ <%-- %> --%> // alert("로그인이 필요합니다."); // location.href='./login.do'; <%-- <% --%> // }else{ <%-- %> --%> const id = 'mkc'; $.ajax({ type: "POST", // HTTP Method url: "./blog-single", // 목적지 data: {userid : id, content :$("#messageCM").val() // 전송 데이터 } }).done(function(data){ console.log('success') }).fail(function (Response) { console.log('에러') }); }); }); </script> 기존 ajax에서는 아래처럼 사용했지만 현 jquery에서는 done fail을 사용하여야한다 success: function (data) { $('#CityID').html(data); }, error: function (ajaxContext) { alert(ajaxContext.responseText) } 공유하기 URL 복사카카오톡 공유페이스북 공유엑스 공유 게시글 관리 구독하기'기'발하고 '창'의적인 블로그 Contents 댓글 0 + 이전 댓글 더보기