0

我在尝试将“id”点击传递给我的控制器时遇到问题。它实际上从未通过 jsRoutes 发出警报。想法是onclick,添加边框样式,然后发送被点击的项目(id)。任何帮助将不胜感激。

<script>
$('.select_it').on('click', function(e){
    var id = $(this).attr('id');

    $(this).toggleClass('myState');
    jsRoutes.controllers.Builder.selectOption(id).ajax({});

    alert(id);
        });
</script>

路线文件:

PUT /category/option/:id        controllers.Builder.selectedOption(id:Long)

GET     /assets/javascripts/routes  controllers.Builder.javascriptRoutes()

JAVASCRIPT 路线:

public static Result javascriptRoutes() {
    response().setContentType("text/javascript");
    return ok(
      Routes.javascriptRouter("jsRoutes",
        controllers.routes.javascript.Builder.selectedOption()
      )
  );
}
4

0 回答 0