我有一个插件,可以在我的网站上创建一个包含步骤的表单。
这是我拨打电话的代码:
$(document).ready(function(){
$('#smartwizard').smartWizard({
lang: {
next: 'Volgende',
previous: 'Vorige'
},
useURLhash: false,
showStepURLhash: false
});
$("#smartwizard").on("leaveStep", function(e, anchorObject, stepNumber, stepDirection) {
var form_data = $("#step_"+ stepNumber +"_form").serialize();
$.ajax({
type:'post',
url:"catalog/calcdiv.php",
data:form_data,
success:function(data){
// indicate the ajax has been done, release the next step
$("#smartwizard").smartWizard("next");
}
});
// Return false to cancel the `leaveStep` event
// and so the navigation to next step which is handled inside success callback.
return false;
});
});
它应该只是进行调用并进入下一步,而不是保持在同一步骤并继续进行 ajax 调用,如下图所示: