我有一个主视图,顶部有进度跟踪器,带有链接。点击链接后,我会看到部分视图。但是,当我发布数据时,部分视图不会显示在主视图中。怎么做到这一点?
<div style="padding-top:2%">
<ol class="progress-tracker">
<li class="step"><a><span class="step-name active" onclick="javascript:showTab('@Url.Action("ReviewOrder","Tax")')" style="">Review order</span></a></li>
<li class="step"><a><span class="step-name" onclick="javascript:showTab('@Url.Action("CreateAccount","Tax")')">Create account</span></a></li>
<li class="step"><a><span class="step-name" onclick="javascript:showTab('Contract',this)">Contract</span></a></li>
</ol>
</div>
function showTab(url) {
$("#partialdiv").load(url, function (text, status, xhr) {
});
}
<div class="container">
<div class="maincontainer" id="partialdiv" >
//Partial View gets shown here on get request.Want to show the same partial view after post request
</div>
</div>
如何在内部div中的主视图中发布后的部分视图?
答案 0 :(得分:0)
我建议您使用ajax加载部分视图。这有助于轻松报告ajax是否已加载或错误报告。
$.ajax({
url: "url",
type: "POST",
dataType: "html",
data: {data: value}
success: function (response) {
$("#partialdiv").html(response);
alert("Partial View is Loaded.....");
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
// help to get error details
}
});