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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:29:00+00:00 2026-05-19T01:29:00+00:00

So I have an MVC Action in my controller public System.Web.Mvc.ActionResult Link(LinkType type) {

  • 0

So I have an MVC Action in my controller

public System.Web.Mvc.ActionResult Link(LinkType type)
        {
            switch (type)
            {
                case LinkType.IC:
                    return RedirectToAction("Indication", "IndicationsController");
                    break;
                case LinkType.Pricing:
                    break;
                case LinkType.Sheets:
                    break;
                case LinkType.Analysis:
                    break;
                case LinkType.Admin:
                    break;
                default : 
                    break;
            }

            return View(@"~\Views\Indications\ShowAString.aspx", "", "Page is not available for selection.");
        }

I want to call this action from JQuery passing the integer value of the button that was clicked. So I have this in my button click method:

$('#btnIc').live('click', function () {
        var typeJSON = {};
        typeJSON["type"] = 1;
        $.ajax({
            type: "POST",
            url: "<%= Url.Action("Link", "Home") %> ",
            dataType: "jsonData",
            data: typeJSON,
            success: function(data) {

            }
        });
    });

Will this redirect the page or will it be waiting for me to do something with (data)?

Is this the correct way to do this?

  • 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-19T01:29:01+00:00Added an answer on May 19, 2026 at 1:29 am

    Returning an entire view in an AJAX request is almost always not the way to go. Instead you want to return XML, JSON or a chunk of HTML. You can return a chunk of HTML by returning a partial by calling PartialView() in the Controller.

    If you are returning HTML, then your jQuery AJAX request needs to be expecting it, so change its dataType to html. Then in the jQuery callback you can just take the received HTML and append it to your page somewhere.

    NOTE: you can use Request.IsAjaxRequest() to return either AJAX data or a full view, and use the same action for both kinds of requests. This helps with progressive enhancement.

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

Sidebar

Related Questions

I have an action like this: public class News : System.Web.Mvc.Controller { public ActionResult
I have an overloaded action in my Controller: public ActionResult AssignList(int id) { ...
I have this little bit of code: using System; using System.Web.Mvc; public class SecureFilter
If I have an ASP.NET MVC controller action that is called from a jQuery
I have an asp.net mvc application with a route similar to: routes.MapRoute(Blog, {controller}/{action}/{year}/{month}/{day}/{friendlyName}, new
I have an ASP.NET MVC project and I have a single action that accepts
I have an ASP.NET MVC project with a form. In the Action method that
I have this set of routes: routes.MapRoute( IssueType, issue/{type}, new { controller = Issue,
The default route in MVC {controller}/{action}/{id} is for the most part quite helpful as
I have a controller action UpdateCustomer(CustomerDto customer) that returns a PartialViewResult with a model

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.