Backbone.js Router initialization doesn't run immediately
问题 My code is as follows: var AppRouter = Backbone.Router.extend({ _data: null, _length: 0, _index: null, _todos: null, _subtodolist: null, _subtodos: null, routes: { "*action": "index", "category/:name": "hashcategory" }, initialize: function(options){ var self = this; if (this._index === null){ $.ajax({ url: 'data/todolist.json', dataType: 'json', data: {}, success: function(data) { self._data = data; self._todos = new TodosCollection(data); self._index = new CategoriesView({collection: self.