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

  • Home
  • SEARCH
  • 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 6099183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:14:37+00:00 2026-05-23T13:14:37+00:00

I wanna implement something like in facebook: after left click on photo, it is

  • 0

I wanna implement something like in facebook:

  • after left click on photo, it is loaded via AJAX
  • after middle click on scroll, it is loaded normally with additional layout

For now I have a View, which is loaded in Controller in two different methods:

public ActionResult Overview()
{
    return View("Overview");
}

public ActionResult OverviewPartialView()
{
    return PartialView("Overview");
}

And in jquery script it looks like this:

$(contentContainer).load(_link + 'PartialView');

My question is, is there a better way to solve that problem?
I have tried with something like that in _ViewStart:

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    if (IsAjax)
    {
        Layout = null;
    }
}

And something like that in Controller:

public ActionResult Index()
{
    if (Request.IsAjaxRequest())
        return PartialView();

    return View();
}

But in those solutions I had a problem with cache, after opening a page with layout, in AJAX request also that page with layout was loaded.

  • 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-23T13:14:38+00:00Added an answer on May 23, 2026 at 1:14 pm

    You could use a single action:

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

    and inside _ViewStart.cshtml:

    @{
        Layout = Request.IsAjaxRequest() ? null : "~/Views/Shared/Layout.cshtml";
    }
    

    Another possibility is to use the following:

    public ActionResult Overview()
    {
        if (Request.IsAjaxRequest())
        {
            return PartialView();
        }
        return View();
    }
    

    then if you want to avoid caching problems you could use a POST request instead of GET:

    $.post(_link, function(result) {
        $(contentContainer).html(result);
    });
    

    or use $.ajax with GET and specify cache: false which will append an unique query string parameter to avoid browsers caching:

    $.ajax({
        url: _link,
        type: 'GET',
        cache: false,
        success: function(result) {
            $(contentContainer).html(result);
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanna implement a javascript like method in java , is this possible ?
I wanna do something like the safari app when fill a form, so when
How to implement like JAVA ‘Protect’ function in Object-C?I wanna access father class method
i wanna implement a bookcase like as ibook's bookcase.who can tell me how to
I wanna implement Facebook connect into my application on android. But i am not
I wanna to implement an effect similiar to that which happens when super Mario
I wanna implement a download-and-install mechanism. I have a source link where my app
I want to implement event management in my application and i wanna know what
I have readed something about it i wanna to do some implementation using this.
I wanna implement this using jquery instead of inline but Its not working, inline

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.