从 bootstrap 模式提交表单后如何加载局部视图和主视图
How to load partial view and main view after submit form from bootstrap modal
我有主视图和局部视图,
主视图包含人名下拉菜单。
当我选择任何特定人的姓名时,该人的详细信息正在部分视图中加载
当部分视图加载人员详细信息时,我必须给出编辑详细信息的复选框
当用户单击复选框时,我正在使用 bootstrap 模态加载编辑视图。
但是当我在加载视图时从模式提交编辑表单时,它没有滚动,它只是加载部分视图而不是包含下拉列表的主视图
这是复选框的代码
<input type="checkbox" id="divchkBox" /> Update Details
这是ajax 调用复选框
$('#divchkBox').click(function () {
if ($(this).is(':checked')) {
$('#myModal').modal();
$('#divchkBox').prop('checked', false);
}
});
这是模态代码
<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">×</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');
我有主视图和局部视图,
主视图包含人名下拉菜单。 当我选择任何特定人的姓名时,该人的详细信息正在部分视图中加载
当部分视图加载人员详细信息时,我必须给出编辑详细信息的复选框 当用户单击复选框时,我正在使用 bootstrap 模态加载编辑视图。
但是当我在加载视图时从模式提交编辑表单时,它没有滚动,它只是加载部分视图而不是包含下拉列表的主视图
这是复选框的代码
<input type="checkbox" id="divchkBox" /> Update Details
这是ajax 调用复选框
$('#divchkBox').click(function () {
if ($(this).is(':checked')) {
$('#myModal').modal();
$('#divchkBox').prop('checked', false);
}
});
这是模态代码
<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">×</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');