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 7446343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:17:22+00:00 2026-05-29T12:17:22+00:00

I am rendering ajax request for action where i am expecting to receive a

  • 0

I am rendering ajax request for action where i am expecting to receive a partial view.
instead i am getting full rendered page including layout page and i am not sure why

my action:

 public PartialViewResult Menu(int? caseId)
    {
        if (caseId != null)
        {
            ViewBag.MenuId = caseId;
        }
        return PartialView("_MenuPartial", null);
    }

My view is rendered using jquery ajax

  function loadMenu(id) {
                $.ajax({
                    data: "/Home/Menu?caseId=" + id,
                    success: function (data) {
                        alert(data);
                        $("#menucontainer").html(data);
                    }
                });
            }

and finally my view is which is named “_MenuPartial”:

<ul id="menu">
    <li>@Html.ActionLink("Home", "Index", "Home")</li>
    <li>@Html.ActionLink("About", "About", "Home")</li>
    @if (@ViewBag.MenuId == 1 || @ViewBag.MenuId == 2)
    {
        <li>link @ViewBag.MenuId</li>
    }
</ul>

Any idea why its returning full page instead a partial view?

  • 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-29T12:17:22+00:00Added an answer on May 29, 2026 at 12:17 pm

    Your .ajax() call looks a bit off. You should be using the “url” property to call your controller action. It would look something like this:

    function loadMenu(id) {
        $.ajax({
            url: "/Home/Menu?caseId=" + id,
            success: function (data) {
                $("#menucontainer").html(data);
            }
        });
    }
    

    Assuming all of your files are in the correct folders, you should get the results you are expecting. If you need to pass a more complex data type to your action, you could serialize a JSON object and send that in the data parameter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While rendering the view page, based on some condition in the controller action I
I have a question about how ASP.NET AJAX partial rendering actually works. Does it:
I have a Webforms, AJAX-enabled web page which, when rendering large amounts of data,
I'm having troubles with rendering response via AJAX. Here is how my .js.haml view
I am rendering out a partial view like so: <div id=cart> <%Html.RenderPartial(Cart, Model); %>
I am rendering a rails partial and I want to alternate the background color
If I'm rendering a regular view in asp.net mvc the only domain object properties
I am wondering whether there is any way to achieve partial JSP rendering in
I am successfully using RJS to implement AJAX on a page.replace.html create.js.rjs. I am
so I have a file that will get $_GET['id'] from an ajax request here

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.