0

我有如下提交按钮:

<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将永远不会出现在屏幕上。

4

1 回答 1

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

    });
})
于 2013-09-22T14:09:32.533 回答