I want to load a partial view using Ajax.PartialView() .But while trying so the Partial view is not loading at all.It is hitting AccountController.Login(),but not rendering the Login page Here is my code .

I want to load Login Page in "formbody" div without refreshing Index page . Please give suggestion on it.


   ViewBag.Title = "Home Page";

    new AjaxOptions
        UpdateTargetId = "formbody"
     <div class="pager glyphicon-align-center" id="formbody">            

             <button type="button" id="login" class="btn btn-default btn-lg">
                 @Ajax.ActionLink("Login", "Login", "Account", new { id = "login" }, new AjaxOptions { })
                 <span class="glyphicon glyphicon-log-in"> </span> @*Login*@
         <button type="button" class="btn btn-default btn-lg" onclick="location.href='@Url.Action("Register", "Account", new { id = "Registerlink" })'">


    </div >
@section scripts {
@*<script src="/Scripts/jquery-1.8.2.js"></script>*@
<script type="text/javascript">
    $("#login").click(function () {
        $(".nav-tabs").html("<li> <a href='#Tab1'> Login</a></li>");




    public ActionResult Login(string returnUrl)
        ViewBag.ReturnUrl = returnUrl;
        bool req = Request.IsAjaxRequest();
        if (Request.IsAjaxRequest())
            return PartialView("Login");
        return View();


 bundles.Add(new ScriptBundle("~/bundles/jquery").Include(

Related posts

Recent Viewed