ログインボタンをクリックすると、jqueryポップアップでログインページを作成しています。パスワードが一致する場合、ポップアップを閉じるページにリダイレクトする必要があります。それ以外の場合、同じjqueryポップアップでエラーメッセージが表示されます
アップデート
私の見解:
@using (Ajax.BeginForm("ValidatePolicyNumber", "Login", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "divCodeInactive"}))
{
<div id="existinginfo" style="margin: 25px; color: #666666; display: none;">
<div class="row">
<p style="margin-bottom: 0px; color: #666666; font-size: 13px; font-weight: bold">
Does the Applicant have an existing Max Life
</p>
<p style="margin-bottom: 0px; color: #666666; font-size: 13px; font-weight: bold">
Platinum Protect Term Plan policy.</p>
</div>
<div class="row" style="margin-top: 20px;">
<div class="small-1 columns" style="padding-left: 0px;">
@Html.RadioButtonFor(m => m.PersonLifeStyle.InsuranceHistoryDetails.HaveAnyInsurancePolicy, true, new { style = "margin-top: -3px;", id = "havePlan" })</div>
<div class="small-3 columns">
<span>Yes</span></div>
<div class="small-1 columns">
@Html.RadioButtonFor(m => m.PersonLifeStyle.InsuranceHistoryDetails.HaveAnyInsurancePolicy, false, new { style = "margin-top: -3px;", id = "havePlan" })</div>
<div class="small-4 columns">
<span style="margin-left: -80px;">No</span></div>
</div>
<div style="margin-top: 30px; font-weight: normal" class="row" id="policynumber">
<span>Please provide Policy Number</span>
<div style="margin-top: 10px;">
@Html.TextBoxFor(m => m.PersonLifeStyle.InsuranceHistoryDetails.PolicyNumber)
</div>
<div class="row" style="text-align: center; margin-top: 10px; clear: both">
<input type="submit" id="policysumit" value="Submit" class="login_button" /></div>
</div>
</div>
<div id="divCodeInactive">
</div>
}
</div>
私の部分的なビュー LoginError.cshtml:
<div id="codeInactive" style="margin: 25px; color: #666666;">
<div class="row">
<p style="margin-bottom: 0px; color: #666666; font-size: 13px; font-weight: bold">
This code is inactive. Please contact your
</p>
<p style="margin-bottom: 0px; color: #666666; font-size: 13px; font-weight: bold">
Max Life Insurance office.</p>
</div>
<div style="margin-top: 30px; font-weight: normal" class="row">
<div class="row" style="text-align: center; margin-top: 10px; clear: both">
<input type="submit" id="codeInactiveSubmit" value="OK" class="login_button" /></div>
</div>
</div>
> My Controller
[HttpPost]
public ActionResult ValidatePolicyNumber(LeadViewModel leadViewModel)
{
if (leadViewModel.PersonLifeStyle.InsuranceHistoryDetails.PolicyNumber != "123") //Some static value for test
{
ViewBag.hasCorrectPolicy = false;
return PartialView("LoginError", leadViewModel);
}
else
{
return RedirectToAction("Home","Home");
}
}