Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7695317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:31:14+00:00 2026-05-31T21:31:14+00:00

The following code shows 1 view, 1 partial view, and 1 controller . The

  • 0

The following code shows 1 view, 1 partial view, and 1 controller. The view contains a button to get the current time and a partial view that displays that time. The button’s click, wired through jQuery, calls $.load() on the partial view’s container.

The first click on the button works perfectly, but no subsequent call gets to the server; the function fires, the load fires, but the server never gets the request.

Any ideas what the problem could be?

Index.cshtml

@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>ContainerView</title>
    <script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(function() {
            $('#btnRefresh').click(function () {
                $("#divTime").load('@Url.Action("GetTime")');
            });
        });
    </script>
</head>
<body>
    <div>
        <input id="btnRefresh" type="button" value="Get Time"/>
        <div id="divTime">
            @Html.Partial("_Time")
        </div>
    </div>
</body>
</html>

_Time.cshtml

@ViewData["Time"]

ContainerController.cs

using System;
using System.Web.Mvc;

namespace PartialViewAjaxFormModel.Controllers
{
    public class ContainerController : Controller
    {
        //
        // GET: /Container/

        public ActionResult Index()
        {
            return View();
        }

        public PartialViewResult GetTime()
        {
            ViewData["Time"] = DateTime.Now.ToLongTimeString();

            return PartialView("_Time");
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T21:31:16+00:00Added an answer on May 31, 2026 at 9:31 pm

    It’s getting cached. I use an action attribute for this:

    public class NoCacheAttribute : ActionFilterAttribute
    {
        public override void OnActionExecuted ( ActionExecutedContext context )
        {
            context.HttpContext.Response.Cache.SetCacheability( HttpCacheability.NoCache );
        }
    }
    
    
    [HttpGet]
    [NoCache]
    public JsonResult GetSomeStuff ()
    {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code that shows a panel. It displays a button on
The following code shows a button that allows you to select a file (should
I have the following code that shows either a bug or a misunderstanding on
Consider the following code which shows compile time error : #include <stdio.h> int main(int
Hallo, I have following jquery code for calling ASP.NET MVC controller method that is
I have the following code snippet that shows a list of numbers, and highlights
I have the following partial view code @model IEnumerable<PDoc.Web.Models.UserDocModel> @using MvcContrib.UI.Grid; @using MvcContrib.UI.Pager; @using
I have the following code that works for a Timer view. The problem is,
I have jquery code that is being reused by a repeatable partial view on
I have a large Ruby on Rails form that has the following partial view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.