Accessing rails routes in javascript

后端 未结 8 1657
星月不相逢
星月不相逢 2020-12-08 19:39

Can anyone explain how i can access the rails routes/names routes in javascript ?

The following are some of the things i tried http://github.com/jsierles/js_named_r

8条回答
  •  粉色の甜心
    2020-12-08 20:19

    See http://tore.darell.no/pages/javascript_routes:

    JavascriptRoutes converts your Rails routes into JavaScript. You can then access (generate) them in the browser (or any other JS environment). It supports both normal and named routes, and creates helper functions for the latter.

    Update: It looks as though someone has forked this if you prefer jQuery: https://github.com/ajnsit/javascript_routes

提交回复
热议问题