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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:33:51+00:00 2026-06-09T20:33:51+00:00

I have a view which is not being called when I step through the

  • 0

I have a view which is not being called when I step through the code I see it get to the action in the controller and return the view but it does not load the view it just stays on the current page.

When a button is clicked on a specific page an ajax post is made calling the next page this does not load.

My contoller action looks like this:

public ActionResult Comparison(int[] y)
        {
            CostModel.Getsuff(y);        

            return View(CostModel);
        }

My route map looks like this:

routes.MapRoute(
        name: "Compare",
        url: "Category/Comparison/{*xxxx}",
        defaults: new { Controller = "Category", Action = "Comparison" }
       ).RouteHandler 

= new CategoriesRouteHandler(); 



public class CategoriesRouteHandler : IRouteHandler
        {
            public IHttpHandler GetHttpHandler(RequestContext requestContext)
            {
                IRouteHandler handler = new MvcRouteHandler();
                var vals = requestContext.RouteData.Values;
                var list = vals["xxxx"].ToString().Split(',');
                int[] y= new int[list.Length];
                for (int i=0; i < list.Length; i++)
                  int.TryParse(list[i].ToString(),out y[i]);

                vals.Add("y", y);
                return handler.GetHttpHandler(requestContext);
            }
        } 

My ajax

  $.ajax({ 
       type: "POST", 
      url: '@Url.Action("Comparison", "Category",  new { Categories = "PLACEHOLDER"})'.replace('PLACEHOLDER', arr),
       dataType: "json", 
       traditional: true, 
       success: function(msg){alert(msg)} 
    } ); 

As I mentioned previously when I trace it, it performs the ajax call fine and hits the action on the controller it just does not launch the view. I thought it may have something to do with the fact that the area is not defined anywhere? So perhaps its throwing it out, can’t see anywhere in MVC 4 to specify different area, but I am new to MVC. Any help will be appreciated.

  • 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-06-09T20:33:52+00:00Added an answer on June 9, 2026 at 8:33 pm

    As I mentioned previously when I trace it, it performs the ajax call
    fine and hits the action on the controller it just does not launch the
    view.

    That’s the whole point of AJAX => stay on the same page. If you want to replace the current page don’t use any AJAX. Use a normal Html.ActionLink.

    And if your controller action only returns a PartialView and you would like to refresh only a portion of your page, you could do that in the success callback:

    $.ajax({ 
        type: "POST", 
        url: '@Url.Action("Comparison", "Category",  new { Categories = "PLACEHOLDER"})'.replace('PLACEHOLDER', arr),
        traditional: true, 
        success: function(result) {
            $('#someIdToRefresh').html(result);
        } 
    }); 
    

    Also notice that I have removed dataType: 'json' because your controller action is not returning any JSON. It’s returning text/html.

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

Sidebar

Related Questions

I have a partial view which contain JavaScript and Ajax, but does not run
In django, I have a form being called from the view, which is passed
i have view controller which contains a button which show the image library ,if
In views.py I have the following view which gets called when a new user
I have a view controller which contains a UISearchBar @interface TradeFindHeaderViewController_iPhone : UIViewController {
I have a view controller MainVC which contains a view where I want to
I am trying to detect touches, but the touchesBegan method is not being called.
I have view on which I defined a custom tagName. I need to be
I have a view which I would like to fill up the entire screen
I have a view which has two labels. When I swipe left I fill

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.