문제: form을 post로 submit 했을 때 action에 있는 경로가 새 페이지로 뜸
예: 게시 조회 팝업에서 첨부파일 등록을 눌렀을 때 새창이 떴다가 닫힌다.
해결:
iframe name 과 form target을 동일하게 해주세요.
1. iframe 생성
<iframe name="frAttachFiles" style="display:none;"></iframe> |
2. form 생성
<form id="frPCSAVE" name="frPCSAVE" method="post" target="frAttachFiles" action=""> <textarea id="txtHTML" name="txtHTML" rows="" cols="" style="display:none;" ></textarea> </form> |
3. submit 실행 javascript
function Submit() {
var sz = "<request></request>";
document.frPCSAVE.action = (URL 입력) ;
document.frPCSAVE.target = "frAttachFiles";
document.frPCSAVE.txtHTML.value = sz;
document.frPCSAVE.submit();
} |