0

ボタンクリックから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);
    }

意見:

 <a href="<%:Url.Action("Details","Employervas") %>"><img src="../../Content/Images/Subscribe now on click.png" class="btn"/></a>

Global.ascx:

   routes.MapRouteLowercase(
         "",
         "employer/details/{id}",
         new { controller = "Employervas", action = "Details", id=UrlParameter.Optional }
         );

ここで、ボタンをクリックすると、データベースの最初からIDが取得されます..

このためのjqueryコードを生成する方法??助けてください..

4

1 に答える 1

0

このコードは、クリックされたボタンの ID を出力します。

$("#button").click(function (e) {
    console.log(e.target.id);
})
于 2017-03-04T18:32:02.640 に答える