Как вызвать действие при нажатии кнопки из JQuery ⇐ Jquery
-
Гость
Как вызвать действие при нажатии кнопки из JQuery
With ASP.NET MVC, I want to call action of controller on Button Click from JQuery.
Controller:
public class HomeController : Controller { // // GET: /Home/ public ActionResult Index() { return View(); } public ActionResult PersonInfo(string name, string city) { // other code for assign ViewData return View(); } } I have two textBox and one Button in Index.chtml page. I want to display Url like 'http://localhost:2526/PersonName'. for city I want optional perameter and don't want in Url. so, I mapped route as below:
routes.MapRoute( "Default", // Route name "", new { controller = "Home", action = "Index" } // Parameter defaults ); routes.MapRoute( "PersonInfo", // Route name "{name}", // URL with parameters new { controller = "Home", action = "PersonInfo", name= "" , city = ""} // Parameter defaults From browser if I enter Url like 'http://localhot:2526/John' then PersonInfo view displayed successfully.
I visited link related my question. But I also want to pass parameters.
Anyone help me How can I call action on button click from JQuery.
With ASP.NET MVC, I want to call action of controller on Button Click from JQuery.
Controller:
public class HomeController : Controller { // // GET: /Home/ public ActionResult Index() { return View(); } public ActionResult PersonInfo(string name, string city) { // other code for assign ViewData return View(); } } I have two textBox and one Button in Index.chtml page. I want to display Url like 'http://localhost:2526/PersonName'. for city I want optional perameter and don't want in Url. so, I mapped route as below:
routes.MapRoute( "Default", // Route name "", new { controller = "Home", action = "Index" } // Parameter defaults ); routes.MapRoute( "PersonInfo", // Route name "{name}", // URL with parameters new { controller = "Home", action = "PersonInfo", name= "" , city = ""} // Parameter defaults From browser if I enter Url like 'http://localhot:2526/John' then PersonInfo view displayed successfully.
I visited link related my question. But I also want to pass parameters.
Anyone help me How can I call action on button click from JQuery.
Мобильная версия