微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

从引导模态提交表单后如何加载局部视图和主视图

如何解决从引导模态提交表单后如何加载局部视图和主视图

我有主视图和局部视图,

主视图包含个人姓名的下拉列表。 当我选择任何特定人员的姓名时,该人员的详细信息会在部分视图中加载

当部分视图加载了个人的详细信息时,我必须提供用于编辑详细信息的复选框 当用户单击复选框时,我正在使用引导模态加载编辑视图。

但是当我从视图加载时从模式提交编辑表单时,它不会滚动,而只是在加载局部视图而不是包含下拉列表的主视图

这是复选框的代码 <input type="checkBox" id="divchkBox" /> Update Details

这是对复选框的ajax调用

$('#divchkBox').click(function () {       
           if ($(this).is(':checked')) {
               $('#myModal').modal();
               $('#divchkBox').prop('checked',false);
           }        
   });

Thi是模式代码

<div class="modal fade bd-example-modal-lg" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content" id='myModalContent'>
            <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 heading" id="myModalLabel">Edit records</h4>
            </div>
            <form id="person">
                <div class="modal-body">                    
                      some editable feilds..                       
                </div>
            </form>
            <input type="submit" class="btn btn-primary searchbtn" value="Save changes" id="Edit_Person" />
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
    </div>
</div>

这是当点击“保存更改”按钮时的ajax调用

 $("#Edit_Person").on("click",function (e) {                       
        $.ajax({
            url: "some url",data: $('#person').serialize(),type: "Get",dataType: "html",success: function (result) {               
                $("#PartialView").html(result) 
                var $j = jQuery.noConflict();
            },});
    });

在哪里我需要更改以加载其主视图和局部视图的视图? 它将是可滚动的。

模态及以上的ajax调用处于局部视图中。

谢谢。

解决方法

请在$("#PartialView").html(result)

之后尝试以下代码
$('#myModal').modal('show');

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。