5
我的應用程序基本上需要一些表單輸入並返回一組結果。我有兩個途徑backbone.js路由查詢傳遞到路由時包含/
routes: {
'': 'search',
'search': 'search',
'results/:query': 'results'
},
results: function(query) {
var search = new ResultsSearchView();
var grid = new GridView({ query: query });
}
如果查詢中包含的任何字符/專(完全可以在這種情況下發生的),它們被添加到URL和我的路線休息。
我試過使用encodeURI()
和encodeURIComponent()
位我沒有任何運氣。你們怎麼處理這些事情?
使用圖示路線,它的工作太棒了。感謝您的幫助。 – Charles