我有一個頁面,其中列出了培訓以供員工對每項培訓進行調查。我在一個div中有多個彈出鏈接,點擊後會打開一個彈出窗口。以下腳本打開彈出窗口。我想在調查提交後更新彈出鏈接依賴新信息的部分,這意味着我只想列出他們的調查不被視爲彈出鏈接的調查。彈出關閉後刷新父div的內容MVC 3.0
$(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");
}
而另一個問題是,即使我刷新頁面將我的模型從控制器刷新呢?
當你說「這是行不通的」,你的意思是你在控制檯中看到的錯誤,或根本沒有發生? –
謝謝你的第一個答案。我沒有看到任何錯誤,沒有任何反應 – Eneramo
「function reloadContent(){ location.reload(); }」當我這樣做刷新所有頁面,但我想刷新'employee_survey'div的鏈接div – Eneramo