用户保存数据后,尝试关闭/关闭引导模式对话框

时间:2017-10-27 11:24:52

标签: jquery twitter-bootstrap

用户保存数据后,尝试关闭/关闭引导模式对话框。我已经关闭了对话框,但它使主页无效。如同,任何按钮都不做任何事情。

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">Modal title</h4>
            </div>
            <div class="modal-body">
                <p>Do you want to save?</p>
                <br />
                <p><label class="Modallabel">Title:</label>
                    <input class="Modalinput" type="text" maxlength="100" title="Name" id="txtTemplateName" value=@ViewBag.Name />
                </p>
                <p><label class="Modallabel">Description:</label>
                    <input class="Modalinput" type="text" maxlength="150" title="Name" id="txtDescription" value=@ViewBag.Description />
                </p>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                <button type="button" class="btn btn-primary" id="saveChangesBtn">Save changes</button>
                <button type="button" class="btn btn-primary" id="saveNewBtn">Save as New</button>
            </div>
        </div>
    </div>
</div>

$("#saveNewBtn").click(function () {     
         var obj = { startDate: $("#startDate").val(), endDate: $("#endDate").val(), templateName: $("#txtName").val(), description: $("#txtDescription").val() };
          $.ajax({                     
             url: "/Report/SaveNew/",
             data: (obj),
             type: "POST",
             success: function (result) {                 
                 $('#myModal').modal('toggle');
                 $('#ReportModalDialog').modal('toggle');
                 $('#modal').modal('toggle');    
             },
             error: OnError
         });         

         function OnError(request, status, error) {
             $("#lblResult").html(request.statusText);   
         }                  
 }); // End of on submit button click

0 个答案:

没有答案