Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8025133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:04:07+00:00 2026-06-04T23:04:07+00:00

Am building a single page site with backbone.js. Am using require.js to make the

  • 0

Am building a single page site with backbone.js. Am using require.js to make the code modular,
but am having problems initializing the backbone router for urls.
I load the main js file using require.js, heres what it looks like

enter code here
//App Namespace
var Chrono = Chrono || {};
//App Config Namespace
Chrono.Config = Chrono.Config || {};
//App Views Namespace
Chrono.Views = Chrono.Views || {};

//Config
Chrono.Config = {
    url:"http://localhost/chronotech/",
    site_url:"http://localhost/chronotech/index.php/",
    data_source:"http://localhost/chronotech/assets/datasource/"
};

require.config({
    paths : {
        'backbone': 'libs/backbone',
        'jquery':'libs/jquery.min',
        'underscore':'libs/underscore',
        'text':'libs/require/text'
    },
    baseUrl : 'assets/js'
});

require(
    ['require', 'underscore', 'backbone', 'jquery'],
    function(require,_, Backbone, $) {
        require(['app'],
            function(require) {
        } );
    } );

And the app.js looks like this

define(['backbone','routers/workspace'],
    function( Backbone,Workspace) {
        $(function () {
            var space = new Workspace();
        } );
    } );

And router file looks like this

define(['jquery','backbone'],
    function($, Backbone) {

        var Workspace = Backbone.Router.extend( {
            routes: {
                "about":"aboutPage",
                "team":"teamPage",
                "contact":"contactPage",
                "work":"portfolioPage",
                "products":"productPage"
            },
            aboutPage : function() {
                alert("about");
            },

            teamPage : function() {
                alert("team");
            },

            contactPage: function() {
                alert("contact");
            },

            portfolioPage : function() {
                alert("work");
            },

            productPage : function() {

            }
        } );

        return Workspace;
    } );

When i load the page, i get the following errors:
“Uncaught ReferenceError: $ is not defined”,
“Uncaught TypeError: Cannot read property ‘Router’ of null”.
What am i doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:04:09+00:00Added an answer on June 4, 2026 at 11:04 pm
    define(['backbone','routers/workspace'],
        function( Backbone,Workspace) {
            $(function () {
                var space = new Workspace();
            } );
        } );
    

    Is it a separate file? Maybe you need to load jQuery in order to use $?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a single page, offline html5 web application using jquery mobile, backbone, underscore
I'm building a single page app with Backbone and Requirejs. For now I've been
I have been building a single page app using requireJS and so far loving
We are building a single page application using jQuery Mobile framework. the scenario we
building a site using PHP and MySQL that needs to store a lot of
I am building a single HTML page for use in a touch-screen kiosk. I
HI, using vs2008 and building a web app. On a asp page called blackjack.aspx,
I'm writing a little single page app (using knockout.js :-)) whereby i have a
I am using using ColdFusion 9.0.1 I am building a site that will use
The site in question is http://getstefan.com Its a single page portfolio site and I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.