Jquery 登录页面不会返回到刷新的索引/主页

Jquery 登录页面不会返回到刷新的索引/主页,jquery,html,ajax,asp.net-mvc,login,Jquery,Html,Ajax,Asp.net Mvc,Login,第一个帖子 嗨 我有一个下拉窗口,您可以在其中验证您的电子邮件和登录密码,从控制器登录/索引,参数通过我编写的一些Jquery代码传递良好 但是当登录成功时,它会在下拉窗口中打开一个页面,而不会刷新主页。我该怎么办 这是代码 function GirisYap() { $("#btnGiris").prop("disabled", true); $('#Loading').show(); $.ajax({ url: "/Login/Index",

第一个帖子

嗨 我有一个下拉窗口,您可以在其中验证您的电子邮件和登录密码,从控制器登录/索引,参数通过我编写的一些Jquery代码传递良好

但是当登录成功时,它会在下拉窗口中打开一个页面,而不会刷新主页。我该怎么办

这是代码

function GirisYap() {
    $("#btnGiris").prop("disabled", true);
    $('#Loading').show();
    $.ajax({
        url: "/Login/Index",
        type: "POST",
        data: $("#frmGiris").serialize(),
        success: function (result) {
            if (result == "OK") {
                $('#mesajAlani').hide();
                $("#btnGiris").prop("disabled", true);
                $('#Loading').show();
                $('#loading-message').html("");
                $('#loading-message').html("Yönlendiriliyor...");
                window.location = "/";
            }
            else {
                $('#mesajAlani').show();
                $("#mesaj").html(result);
                $("#btnGiris").prop("disabled", false);
                $('#Loading').hide();
                $('#loading-message').html = "Kontrol ediliyor...";
            }
        }
    });
}
这些是获取视图中参数的形式

<form class="frm-single" id="frmGiris">
           <div class="inside">
               <div class="frm-input">
                  <input type="text" placeholder="E-mail" class="form-control submit_on_enter" name="Email">
                  <i class="fa fa-user frm-ico"></i>
               </div>

                <div class="frm-input">
                   <input type="password" placeholder="Parola" class="form-control submit_on_enter" name="Parola">
                   <i class="fa fa-lock frm-ico"></i>
                </div>

                <button id="btnGiris" type="button" class="frm-submit" onclick="GirisYap(); return false;">Giriş<i class="fa fa-arrow-circle-right"></i></button>

                 <div class="checkbox" id="mesajAlani" style="display:none">
                      <div id="mesaj" class="alert alert-info" style="background-color:red;color:white;">Giriş için gerekli bilgileri doldur.</div>
                 </div>

                 <div id="Loading" style="text-align:center;display:none;">
                     <i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>
                     <p id="loading-message">Kontrol ediliyor...</p>
                 </div>
            </div>
  </form>

我认为这是缓存的问题。将以下代码添加到您的操作中以禁用输出缓存

public class MyController : Controller
{
    [OutputCacheAttribute(VaryByParam = "*", Duration = 0, NoStore = true)] // will disable caching for Index only
    public ActionResult Index()
    {
       return View();
    }
}