ajax form값 전체 전송하기

<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="../jquery.form.min.js"></script>

 

  <input type="button" id="btn_save22" onclick="final_submit(); return false;" style="float:right; margin-top:-15px;border-radius:3px" class="btn_mint btn_md propose"  value="매니저에게 최종제출하기">

 

 

<script>
 function final_submit(){

 var answer = confirm('매니저에게 최종 제출하시겠습니까?');

 if(answer){

        var form = $("form")[0];       
        var formData = new FormData(form);

  formData.append('final_submit','ok');


        $.ajax({
            cache : false,
            url : "/mystep/mystep4", // 요기에
            processData: false,
            contentType: false,
            type : 'POST',
            data : formData,
            success : function(data) {
                //var jsonObj = JSON.parse(data);
                 $("#result").html(data); 
            }, // success
   
            error : function(xhr, status) {
                alert(xhr + " : " + status);
            }
        });

 }

 }

 

</script>

 

--------------------------------------------

 

 

 

<form id="form1" name="form1" method="post">

    

    // 생략

    

    <input type="button" value="확인" onclick="test1(); return false;">

</form>

 

<script>

    function test1(){

        var formData = $("#form1").serialize();

 

        $.ajax({

            cache : false,

            url : "${pageContext.request.contextPath}/testForm1", // 요기에

            type : 'POST', 

            data : formData, 

            success : function(data) {

                var jsonObj = JSON.parse(data);

            }, // success 

    

            error : function(xhr, status) {

                alert(xhr + " : " + status);

            }

        }); // $.ajax */

    }

</script>

첨부파일

jquery.form.min.js (14.9 KB) 6회 2021-12-02 11:14
|

댓글 1개

좋은데 위에거는 뭐고 아래거는 뭔가요?
xtPath}/testForm1 이게 .php가 아니어도 되나요?
댓글을 작성하시려면 로그인이 필요합니다.

그누보드5 팁자료실

+
제목 글쓴이 날짜 조회
4년 전 조회 4,288
4년 전 조회 3,319
4년 전 조회 3,609
4년 전 조회 2,881
4년 전 조회 3,233
4년 전 조회 7,080
4년 전 조회 2,977
4년 전 조회 6,795
4년 전 조회 8,470
4년 전 조회 3,877
4년 전 조회 4,255
4년 전 조회 3,070
4년 전 조회 3,733
4년 전 조회 3,116
4년 전 조회 3,588
4년 전 조회 3,316
4년 전 조회 2,826
4년 전 조회 3,781
4년 전 조회 3,803
4년 전 조회 2,949
4년 전 조회 4,414
4년 전 조회 3,422
4년 전 조회 2,753
4년 전 조회 3,527
4년 전 조회 3,209
4년 전 조회 3,728
4년 전 조회 3,850
4년 전 조회 3,271
4년 전 조회 4,252
4년 전 조회 4,610