我有一个页面列出了员工的培训,以便为每个培训进行调查。我在一个 div 中有多个弹出链接,单击时会打开一个弹出窗口。以下脚本打开弹出窗口。我想在提交调查后用新信息更新弹出链接所依赖的部分,这意味着我只想列出他们的调查不被视为弹出链接的培训。
$(document).ready(function () {
$('.addSurvey').click(function () {
$.ajax({
url: this.href,
type: 'GET',
cache: false,
context: this,
success: function (result) {
$(this).next('.result').html(result).dialog({
autoOpen: true,
title: 'Anket',
width: 500,
height: 'auto',
modal: true,
beforeClose: function (event, ui) {
reloadContent();
}
}); //end of dialog
} //enf of success function
}); //end of ajax call
return false;
});
});
要为每个培训创建链接并列出弹出链接,我使用以下页面。
@{if (Model.TrainingList == null || !Model.TrainingList.Any())
{
<p>
Personel için anket bilgisi bulunamadı!</p>
}
else
{
foreach (var training in Model.TrainingList)
{
<table class="surveyTable">
@{ if (training.Survey != null)
{
<tr>
<td class="view_detail_label">
Eğitim Adı
</td>
<td>
@(training.Name != null ? @training.Name.Name : "")
</td>
</tr>
<tr>
<td class="view_detail_label">
Eğitim İçeriği ve Programın Değerlendirilmesi Ortalaması
</td>
<td>
@((training.Survey.Context + training.Survey.Example
</td>
</tr>
<tr>
<td class="view_detail_label">
Eğitimlerin Değerlendirilmesi
</td>
<td>
@((training.Survey.Knowledge))
</td>
</tr>
<tr>
<td class="view_detail_label">
Eğitim Materyallerinin ve Ortamının Değerlendirilmesi
</td>
<td>
@((training.Survey.Tool + training.Survey.Source)
</td>
</tr>
}
else
{
<tr>
<td class="view_detail_label">
Eğitim Adı
</td>
<td>
@Html.ActionLink(
training.Name.Name,
"AddSurvey",
new
{
employeeId = Model.Id,
trainingId = training.Id
},
new
{
@class = "addSurvey"
}
)
<div class="result" style="display:none;"></div>
</td>
</tr>
}
}
</table>
}
}
}
上面的页面是子页面
<script type="text/javascript">
$('#tab-container').easytabs();
</script>
<div id="tab-container" class="tab-container">
<ul class="etabs">
<li class="tab"><a href="#employee_common">Genel Bilgiler</a></li>
<li class="tab"><a href="#employee_education">Eğitim Bilgileri</a></li>
<li class="tab"><a href="#employee_work">İş Tecrübesi</a></li>
<li class="tab"><a href="#employee_other">Kişisel</a></li>
<li class="tab"><a href="#employee_files">Dosyalar</a></li>
<li class="tab"><a href="#employee_turnike">Turnike</a></li>
<li class="tab"><a href="#employee_survey">Eğitim Anket</a></li>
<li class="tab"><a href="#employee_turnike_report">Kapı Giriş Raporu</a></li>
<li class="tab"><a href="#employee_training">Kurumsal Eğitimler</a></li>
</ul>
<div id="employee_common">
@{ Html.RenderPartial("_DetailsCommon"); }
</div>
<div id="employee_education">
@{ Html.RenderPartial("_DetailsEducation"); }
</div>
<div id="employee_work">
@{ Html.RenderPartial("_DetailsWork"); }
</div>
<div id="employee_other">
@{ Html.RenderPartial("_DetailsPersonal"); }
</div>
<div id="employee_survey">
@{ Html.RenderPartial("_DetailsSurvey");}
</div>
我在 _DetailsSurvey.cshtml 文件中有以下脚本仅刷新 div 部分,但它不起作用。
function reloadContent() {
$(document).load(window.location.href + " #employee_survey");
}
另一个问题是,即使我刷新页面,我的模型也会从控制器刷新吗?