2013-10-14 2 views
0

스프링 웹 플로우를 사용하고 뷰 상태 페이지의 포털 렌더링에 문제가 있습니다. 나는 항상 $ ('# form')을 얻는다. ajax 호출 후 serialize() = "". 나는 다음 Ajax 호출이 있습니다Ajax 호출 후 비어있는 직렬화 양식

var bindContinueButton = function() { 
    $('#continueBtn').bind('click', function() { 
     var url = $('#form').attr('action') + setFlowEvent('continue'); 
     $.ajax({ 
      type : "POST", 
      url : url, 
      cache:false, 
      data: $('#form').serialize(), 
      dataType: "text", 
      success : function(response) { 
       var newContent = $('#ajax-content', response).html(); 
       $('#ajax-content').html(newContent); 
      }, 
      error : function(XMLHttpRequest, textStatus, errorThrown) { 
       alert("error!"); 
      } 
     }); 
    }); 
}; 

을 그리고 렌더링 JSP 다음 냈다가 : 내가보기 자동 내 서버 유효성 검사기를 실행 양식을 제출할 때

<div id="ajax-content"> 
    <jsp:include page="../../jsp/common/head.jsp"/> 
<table class="t1"> 
    <tbody> 
    <portlet:actionURL var="actionURL" portletMode="view"> 
     <portlet:param name="execution" value="${flowExecutionKey}"/> 
    </portlet:actionURL> 

    <form:form id="form" modelAttribute="model" action="${actionURL}" method="post"> 
     <jsp:include page="../../jsp/creation/popup-save-as.jsp"/> 
     <jsp:include page="../../jsp/creation/documentNumber.jsp"/> 
     <jsp:include page="../../jsp/creation/initialAmount.jsp"/> 
     <jsp:include page="../../jsp/creation/currentAccount.jsp"/> 
     <jsp:include page="../../jsp/creation/addRegularPayment.jsp"/> 
     <jsp:include page="../../jsp/creation/regularPaymentFields.jsp"/> 
     <jsp:include page="../../jsp/creation/otherConditions.jsp"/> 
     <jsp:include page="../../jsp/creation/certification.jsp"/> 
    </form:form> 

    <%-- BUTTONS --%> 
    <jsp:include page="../../jsp/creation/actionButtons.jsp"/> 
    </tbody> 
</table> 
</div> 

그래서 나는 아약스 콜백 성공 기능으로 이동보다 이후 $ ('# ajax-content') .html (newContent)이 (가) $ ('# form')이됩니다. serialize(). 이 문제를 해결하도록 도와주세요. 성공 콜백에서 콘텐츠를 교체 한 후 감사

답변

0

당신은 다시 바인딩해야합니다

우리는 아약스를 잘 작성 제출 동안 만 입력 값을 얻을 필요가
$('#continueBtn').bind('click', function(){...}); 
-1

???

따라서 다음과 같이 스크립트에 $('#form').serialize() 대신 $('input').serialize()을 사용할 수 있습니다.