简体   繁体   English

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

[英]How to load partial view and main view after submit form from bootstrap modal

I have main view and partial view,我有主视图和局部视图,

main view contains drop down for person's name.主视图包含人名下拉列表。 when I am choosing any specific person's name that time person's details are loading in partial view当我选择任何特定人员的姓名时,该人员的详细信息正在部分视图中加载

when partial view is loading with person's details,I have to give checkbox for edit details when user clicks on checkbox ,I am loading edit view with bootstrap modal.当局部视图加载个人详细信息时,当用户单击复选框时,我必须为编辑详细信息提供复选框,我正在加载带有引导模式的编辑视图。

but when I submit edit form from modal that time when view is loading ,it is not scrolling and it is just loading partial view and not main view which contains dropdown但是当我在加载视图时从模态提交编辑表单时,它没有滚动,它只是加载部分视图而不是包含下拉菜单的主视图

This is code for checkbox <input type="checkbox" id="divchkBox" /> Update Details这是复选框的代码<input type="checkbox" id="divchkBox" /> Update Details

This is ajax call for checkbox这是复选框的ajax调用

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

Thi is modal code这是模态代码

<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>

This is ajax call when click on save changes button这是单击保存更改按钮时的 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();
            },            
        });
    });

where I need to change to load view with its main and partial view ?我需要在哪里更改加载视图及其主视图和部分视图? and it will be scrollable.它将是可滚动的。

Modal and above ajax calls are in partial view. Modal 及以上 ajax 调用在局部视图中。

Thank you in advance.先感谢您。

请在$("#PartialView").html(result)之后尝试以下代码

$('#myModal').modal('show');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM