1

当我单击登录按钮时,我正在 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");
            }
        }
4

0 回答 0