Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从按钮获取id单击jquery_Jquery_Jquery Ui_Routes - Fatal编程技术网

从按钮获取id单击jquery

从按钮获取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

我想从按钮点击中获取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 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);
})