Jquery将id传递给控制器​​Play Framework

时间:2013-10-11 01:36:37

标签: javascript jquery routes playframework-2.0 js-routes

我无法尝试将“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 ROUTES:

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

0 个答案:

没有答案