我有如下的提交按钮:
<form:form commandName="DRCNdetails" id="frm1" method="POST" action="addNewDelayReason.do" >
</form:form>
<button class="btnStyle blueBtn" id = "subBtn" onclick="showBox()">
<span class="left">
<span class="right">Submit</span>
</span>
</button>
$("#subBtn").click(function()
{
//if($("#reasonValue").val(missedReasonValue)!="")
var missedReasonValue =$("#mrclist").val();
var delayReasonValue=$("#text1").val();
var preFixValue=$("#text2").val();
alert("missedReasonValue :: "+missedReasonValue);
$("#reasonValue").val(missedReasonValue);
document.getElementById("frm1").submit();
showLtBox('mask', 'confirmationMsg');
fadeOutLtBox('asgnExistMisdReasonCode');
});
function showBox(){
alert('hi in showlightbox');
showLtBox('mask', 'confirmationMsg');
fadeOutLtBox('asgnExistMisdReasonCode');
}
单击提交按钮,相应的数据将保存在数据库中,但我无法显示弹出屏幕showLtBox('mask', 'confirmationMsg');
。它会显示几秒钟,并且名为div confirmationMsg
的弹出窗口阻止程序将永远不会出现在屏幕上。
答案 0 :(得分:0)
令人耳目一新,因为您没有使用ajax来提交表单。
$('#frm1').on('submit',function(e){
e.preventDefault()
var url = $(this).attr('action')
var formData = $(this).serialize()
//Submit the request via Ajax
$.post( url, data, function( data ) {
//Show the alert box you want to show
showLtBox('mask', 'confirmationMsg'); //or th showBox() you defined
});
})