Anyone know backbone.js? Getting an 'Uncaught ReferenceError'

I’m using this code:

   <!DOCTYPE html>
  <html>
  <head>
    <meta charset="utf-8">
    <title>Organizer</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.2.1/backbone.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/backbone-localstorage.js/1.1.16/backbone.localStorage.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.min.css">
    <script src="js/app.js"></script>
    <script src="js/routes.js"></script>
  </head>
  <body>
    <div id="app" class="container"><h1>Hello World!</h1></div>
  </body>
</html>

Which produce this error when I type “backbone” into the console.

Uncaught ReferenceError: backbone is not defined
    at <anonymous>:2:1
    at Object.InjectedScript._evaluateOn (<anonymous>:895:140)
    at Object.InjectedScript._evaluateAndWrap (<anonymous>:828:34)
    at Object.InjectedScript.evaluate (<anonymous>:694:21)

Every page I’ve looked at suggests it’s related to the script tag order, specifically that underscore.js has to be loaded before the backbone.js file, which it is, as you can see below.

Can anyone offer me any suggestions as to where to look?

Sorry, can I have a bit of background - why are you typing “backbone” into the console?

Part of something I’m taking an look at, and it was suggested I do so. It should come up with some details of the version of backbone that has been loaded.

OK, problem solved. It should have been “Backbone”, not “backbone” :blush:

And many thanks to @jeffreylees too

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.