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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:57:32+00:00 2026-06-17T14:57:32+00:00

How to return another view of the same controller? I made some debugging for

  • 0

How to return another view of the same controller? I made some debugging for the application: the ajax method calls the controller action, pass the parameter, executes the instructions. At the

return View("GetEmployeeDays", model);,

the “GetEmployeeDays” view receives the values from model and is populated, but finally in the browser I receive the initial view (from I made the request) – not the GetEmployeeDays view

routing code from Global.asax:

public static void RegisterRoutes(RouteCollection routes)
 {
  routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  routes.MapRoute(
      "Default", // Route name
      "{controller}/{action}/{id}", // URL with parameters
       new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
    );          
  }

JQuery code that calls the action controller’s and pass a parameter:

<script type="text/javascript">
  $(document).ready(function () {
  $('li').click(function () {
  $.ajax({
    url: '@Url.Action("GetEmployeeDays", "ApproveWork")',
    type: 'GET',
    dataType: 'json',
    contentType: 'application/json; charset=utf-8',
    data: { userCode: $(this).attr('id') }
   })
  });
});

Controller action that should render the GetEmployeeDays view:

   [HttpGet]
   public ActionResult GetEmployeeDays(string userCode)
   {
      .....
    return View("GetEmployeeDays", model);
   }
  • 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-17T14:57:33+00:00Added an answer on June 17, 2026 at 2:57 pm

    If you want to simply load something to a part of your page without reloading to a new page, you should update the specific part of your page in the callback of your ajax function.

    $(function(){
     $('li').click(function () {
         var uCode=$(this).attr("id");
         $.get("@Url.Action("GetEmployeeDays","ApproveWork")?userCode="+uCode,
                                                              function(response){
           $("#DivToBeUpdated").html(response);
         });
     });
    });
    

    If you want to redirect to a new view, you should do it by updating the location.href property value.

    $(function(){
     $('li').click(function () {
         var uCode=$(this).attr("id");
         var url="@Url.Action("GetEmployeeDays","ApproveWork")?userCode="+uCode;
         window.location.href=url;         
         });
     });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If you have a controller method like so: @expose(json) def artists(self, action=view,artist_id=None): artists=session.query(model.Artist).all() return
I'm trying to return the ajax success array from one function to another. For
I'm simply trying to pass the ModelState from one action to another in the
i am new with codeigniter.I have written controller,model.view. I want to execute the another
My controller actions: [AcceptVerbs(HttpVerbs.Get)] public ActionResult Login() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult
I have a controller where all of the action methods contain the same code:
I have a tab bar controller with different view controllers all using the same
I want to pass an input model from a partial view to a controller.
I defined the Scheme procedure to return another procedure with 2 parameters : (define
Sorry, but I'm new to accessing return from another domain. I have this url

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.