JAVASCRIPT POST 방식으로 값 넘기기

 function GoModifyForm(camp_id,type1,type2)
{
 
    var form = document.createElement("form");
    form.setAttribute("charset", "UTF-8");
    form.setAttribute("method", "Post");  //Post 방식
    form.setAttribute("action", "/test/test1/test2/modifyform"); //요청 보낼 URL
 
    var hiddenField = document.createElement("input");
    hiddenField.setAttribute("type", "hidden");
    hiddenField.setAttribute("name", "camp_id");
    hiddenField.setAttribute("value", camp_id);
    form.appendChild(hiddenField);
    
    hiddenField = document.createElement("input");
    hiddenField.setAttribute("type", "hidden");
    hiddenField.setAttribute("name", "type1");
    hiddenField.setAttribute("value", type1);
    form.appendChild(hiddenField);
 
    hiddenField = document.createElement("input");
    hiddenField.setAttribute("type", "hidden");
    hiddenField.setAttribute("name", "type2");
    hiddenField.setAttribute("value", type2);
    form.appendChild(hiddenField);
    
    document.body.appendChild(form);
    form.submit();	
}

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다