Search code examples
javascriptjqueryhtmlbackbone.jsjsfiddle

Getting a Backbone.js fiddle working


I am stuck on a seemingly simple Backbone.js issue and would like to set up a fiddle to iteratively work through the problem. However... I can't seem to get the fiddle to load the scripts properly, or at least I am no using the correct "method".

Here is the link to the Jsfiddle

I've selected the following external sources, and provided each with links to the appropriate cdnjs sites.

enter image description here

However I'm still getting the following errors:

The firs tone deals with the Underscore.js library:

Message: Uncaught TypeError: Cannot read property 'each' of undefined - backbone.js:219

Code: _.each(listenMethods, function(implementation, method)

The second refers to my first Backbone declaration:

Message: Uncaught ReferenceError: Backbone is not defined - (index):47

Code: var QuoteHistory = Backbone.Model.extend(

Solution

  • You should at first load jQuery and Underscore and then the Backbone library. Also note that jQuery UI Bootstrap.js depend on jQuery, so the jQuery library should be loaded before these libraries; however, as you are loading jQuery in the "Frameworks & Extensions" panel you don't have to load it again manually.