我将部分视图 (_AddExp) 显示为用于添加新项目的模式弹出内容。关闭 modalpopup 后,我尝试再次显示 Modalpopup 以添加新项目,但 modalpopup 未打开。我收到错误 TypeError: $(...).modal is not a function on the line $('#AddExpModal').modal('show');
<p>
<button onclick="AddExperience()" class="btn btn-primary">Add experience</button>
</p>
function AddExperience(){
$('#AddExpModal').modal('show');
$("#AddExpInfo").load("/Account/ExperienceAdd/"+ @ViewBag.AccountId); //Loads the Partial view.
}
<div id="AddExpModal" class="modal hide fade">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Add experience detail</h3>
</div>
<div class="modal-body" id="AddExpInfo">
</div>
<div class="modal-footer">
<button onclick="ClosePopup();" class="btn btn-primary">Close window</button>
</div>
//Code used after closing popup.
function ClosePopup(){
$('#AddExpModal').modal('hide');
$("#AddExpInfo").html("");
$("#ExperienceList").load("/Account/ExperienceList/"+ @ViewBag.AccountId);
}
在我添加新体验的部分视图(_Addexp.cshtml)中,我使用 Document.Ready 事件和其他一些函数来发布 FORM 数据,这是第二次不显示弹出窗口的原因吗?我该如何解决这类问题?