从按钮获取id单击jquery
我想从按钮点击中获取id 控制器:从按钮获取id单击jquery,jquery,jquery-ui,routes,Jquery,Jquery Ui,Routes,我想从按钮点击中获取id 控制器: //Get public ActionResult Details(int id) { // Get member details for the specified member id VasPlan vasplan = _repository.GetVasPlan(id); // return this member to the default view return
//Get
public ActionResult Details(int id)
{
// Get member details for the specified member id
VasPlan vasplan = _repository.GetVasPlan(id);
// return this member to the default view
return View(vasplan);
}
视图:
在这里,当我单击按钮时,它将从数据库中的第一个获取id
如何为此生成jquery代码?请帮助我。此代码打印出单击的按钮的id
$("#button").click(function (e) {
console.log(e.target.id);
})
不,我对jquery不太了解。我不知道如何放置从按钮单击中检索id的代码..可能重复
routes.MapRouteLowercase(
"",
"employer/details/{id}",
new { controller = "Employervas", action = "Details", id=UrlParameter.Optional }
);
$("#button").click(function (e) {
console.log(e.target.id);
})