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

  • Home
  • SEARCH
  • 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 8299331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:06:41+00:00 2026-06-08T16:06:41+00:00

I have recently started working with backbone.js and i am finally started to get

  • 0

I have recently started working with backbone.js and i am finally started to get my head around after many tutorials.

One thing i am stuck on is how to use the routing to allow a list to pull different rest request.

Say i have the following in my collection

 var NewsCollection = Backbone.Collection.extend({  
          model : News,  
          url: 'http://api.example.com/index.php/news/all/format/json',  
        });

From my understanding correct me if i am wrong backbone stores all the data pulled from the above feed into my model that extends this collection, this will all work i will pull in the feed and then display it in the view

This is where i get confused within my routing i have the following.

var NewsRouter = Backbone.Router.extend({
            routes: {
                "": "defaultRoute",
                "news/:country_code":"updatedRoute"
            },

            defaultRoute: function () {
                console.log("defaultRoute");
                var movies = new NewsCollection()
                new NewsView({ collection: movies });
                movies.fetch();
                //setInterval(function(){movies.fetch({success: function(){}});}, 60000);
            },
            updatedRoute:function (country_code) {

                //confused
                    this.movie = this.movies.get(country_code);

            }

        })

I need to run the updatedRoute function when that will display a list of news based on cat of country code see below.
http://api.example.com/index.php/news/country/gb/format/json

How do i update the whole feed when a list item is click so the browser url would be.

http://localhost:8888/backbonetut/#news/gb

my list item is.

<li><a href='#news/gb'>GB</a></li>

I can get that in the updateRoute function with

this.movie = this.movies.get(country_code);

Can someone please help

  • 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-08T16:06:44+00:00Added an answer on June 8, 2026 at 4:06 pm

    You can either override the fetch function on your collection or temporarily change the url of the collection in your router action.

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

Sidebar

Related Questions

We recently started working with XML files, after many years of experience with the
I have recently started working on a very large C++ project that, after completing
This is a very elementary I realize, I have recently started working with asp.net
I have recently started working on an app which has both Java and native
I have recently started working on my master thesis in C that I haven't
I have recently started working in iOS Development, I have noticed the app size
I have recently started working on a web application at a new company and
I have a project that I have recently started working on seriously but had
I've recently started working with multi-threaded Winform applications and have run up against a
I have recently just started working with Lucene (specifically, Lucene.Net) and have successfully created

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.