我有这样的网址:
something.com/#page/id(使用backbone.js构建)
我想检查是否存在该ID使用underscore.js在DOM中使用它,我知道我可以用window.location.href.split来做到这一点,但我只是想知道是否有更合适和更清洁的方式..
答案 0 :(得分:1)
"page/:id": "someFunction" #this will be your route and it should have a function.
# In that someFunction you can check parameter (id) as shown below.
someFunction: function (id) {
console.log(id);
}