我正在使用 spring webflow,但在部分渲染视图状态页面时遇到了问题。在 ajax 调用之后,我总是得到$('#form').serialize() = "" 。我有下一个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 回调成功函数,在$('#ajax-content').html(newContent)之后,我得到空的 $('#form').serialize()。请帮我解决这个问题。谢谢