我无法尝试将“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()
)
);
}