So I have 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 a 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 it redirect the page or will it wait for me to do something with (data)?
Is this being done right?
source share