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 7669891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:41:52+00:00 2026-05-31T15:41:52+00:00

Trying to get the simplest backbone router to work to see if I like

  • 0

Trying to get the simplest backbone router to work to see if I like how it works. I am able to get models to work so I think it’s loading correctly but when I access with http://localhost:3000/xxx#testindex, nothing happens.

edit 1
I thought there wasn’t an error but now I’m getting h is not a function. Hmm… I am a little stumped.

What am I doing wrong? Thx

<html>
  <head>
   <script src='/assets/underscore.js'></script>
   <script src='/assets/backbone.js'></script>

  </head>
<body>
<script>
var PageRouter=Backbone.Router.extend({
  routes:{
    "testindex": "index"
  },
  index: function(){ alert("I am here in index")}
});

window.onload=function(){
 // alert("this loaded");
 var app_router = new PageRouter;
 Backbone.history.start();
}
</script>

<a href="#testindex">Activate route</a>
</body>
</html>
  • 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-05-31T15:41:53+00:00Added an answer on May 31, 2026 at 3:41 pm

    Backbone depends on jQuery or Zepto:

    For RESTful persistence, history support via Backbone.Router and DOM manipulation with Backbone.View, include json2.js, and either jQuery ( > 1.4.2) or Zepto.

    Emphasis mine. You forgot to include jQuery or Zepto and that’s where your “h is not a function” error comes from. Since you’ll probably be pulling in jQuery, you should use $(function() { ... }) instead of the old school window.onload.

    Once you sort that stuff out, it works fine: http://jsfiddle.net/ambiguous/3XUxS/

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

Sidebar

Related Questions

I am trying get Struts 2 and Tiles to work and I am using
Trying to get this expression to work, can someone look at it and tell
I can't get spring annotations to work at all, I'm just trying to get
So, I'm trying to get gtksourceview python bindings work under windows (I'm developing a
I was trying to use IBrokers package with the simplest code like below: library(IBrokers)
I am trying to get the below html code to work and can't figure
After trying to get sftp working ive ended up with the simplest possible sample
I am trying to get my head round what appears to be the simplest
I'm trying to get what I think is a really nice bit of HTML5
I have the simplest of makefiles: threads: gcc threads.c -o threads but I get

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.