There’s no documentation for Backbone.history.loadURL on backbone.js website http://backbonejs.org/#History-start Although I have a general idea what result it produces in some applications I’ve looked at, I’m not exactly sure how it works, in the sense of which url it chooses to load and how it knows to load a certain url over another. Can anyone explain?
$.ajax({
url: "json/Backboneapp_data.json",
dataType: 'json',
data: {},
async: false,
success: function (data)
{
_this._data = data;
_this._items = new ItemCollection(data);
_this._view = new MenuView({ model: _this._items });
_this._view.render();
Backbone.history.loadUrl();
}
});
Notes on
loadUrlfrom the Annotated Source:So, if the current URL fragment (or the one you pass as a parameter) is valid, then it invokes
route. Note also that the function returns true if it resolved a valid route based on the fragment, otherwise false.If it helps clarify: look down in the source, and you’ll notice that
loadUrlis whatnavigatecalls if you specify the optiontrigger:true.