<%
/**
 * <pre>
 * @Class Name : deleteMembershipForm.jsp
 * 
 * @Description : 회원탈퇴폼
 * 
 * 
 * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
 *
 * </pre>
 *
 * @ ------------    --------    ---------------------------
 * @ 수정일                     수정자             수정내용
 * @ ------------    --------    ---------------------------
 * @ 2021. 9. 9.    JSYOO       최초 생성
 *
 * 
 * @author 이씨플라자 * DIGITALSHIP JSYOO
 * @since 2021. 9. 9.
 * @version 1.0
 *
 */
 %>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script>
function deleteMembership()
{
	$.ajax({
        url : "${pageContext.request.contextPath}/member/deleteMembership.ajax",
        type : "POST",
        async: false,
        data : {password:$("#password").val()},
        success : function(result){
            if(result=="delete")
           	{
                alert("탈퇴처리 되었습니다.감사합니다."); 	
                location.href="${pageContext.request.contextPath}/index.do"
           	}else if(result=="mismatch")
          	{
           		alert("비밀번호가 일치하지 않습니다.다시 확인해주세요.");
          	}
            
        },error : function(){
                            
        }
    })
}
</script>
</head>
<body>
    <form id="deleteMembershipForm" name="deleteMembershipForm">
	    <p1>회원탈퇴</p1><br>
	    이름 : <c:out value="${loginVO.name }"/><br>
	    이메일 : <c:out value="${loginVO.email }"/><br>
	    <input type="password" id="password" name="password" placeholder="비밀번호"><br>
	    <input type="button" onclick="deleteMembership();" value="탈퇴하기"><input type="button" onclick="location.href='${pageContext.request.contextPath}/userInfo/putMyInfo.do'" value="취소">
    </form>
</body>
</html>