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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:41:17+00:00 2026-06-14T04:41:17+00:00

I have two view files views.js and views2.js .On button click views.js call.On views.js

  • 0

I have two view files views.js and views2.js .On button click views.js call.On views.js there is a button that needs to triggers views2.js.But the problem is that on button click views2.js
is not working.

I have written some code.
In views.js

define( ["backbone"], function(Backbone) {

var UserView = Backbone.View.extend({
    tagName: "div",
    render: function(){
        this.$el.html(this.model.get("desc") + "<button id='btn2' class='btn btn-             primary'>Next Page</button>");
        return this;
    }
});

var NextPageView = Backbone.View.extend({
    events: {
        'click': 'firstquestion'
    },

    render: function(){        
        return this;
    },

    firstquestion: function(){
        //to solve circular dependency
        require(['routes'],function(routes){
            var router = routes.pageRouter;
            router.navigate('view', {trigger: true});
       });   
    }
 });
    var views2 = require("views2");//should I call views2 here
    var np2 = new views2.NextPageView2({el: $("#btn2")});
 return {
    UserView: UserView,
    NextPageView: NextPageView
 };
});

In views2.js

define( ["backbone"], function(Backbone) {
var UserView2 = Backbone.View.extend({
    tagName: "div",
    render: function(){

        this.$el.html(this.model.get("desc") + "<button id='btn3' class='btn btn-primary'>Next Page</button>");
        return this;
    }
});

var NextPageView2 = Backbone.View.extend({
    events: {
        'click': 'secondquestion'
    },
    render: function(){
        return this;
    },
    secondquestion: function(){
        require(['routes2'],function(routes2){
            var router = routes2.pageRouter2;
            router.navigate('view', {trigger: true});
        });
    }
});
return {
    UserView2: UserView2,
    NextPageView2: NextPageView2
};
});
  • 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-14T04:41:18+00:00Added an answer on June 14, 2026 at 4:41 am

    You need to put a Require.js dependency on the calling view.

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

Sidebar

Related Questions

I have two views that flip based on a button press within the view.
I have two view controllers that allow changes to the Address Book. The first
I have two partial view and I want to call one of them in
Am building a typical admin portal - there's two shared partial view .cshtml files
The problem is: I have the an Ajax.BeginForm, that essentially consists of two dropdownlists
I have two nib files, one that will open at startup and another that
I have a Delphi 7 application that has two views of a document (e.g.
If i have two nibs with several views, is there a way for me
I have two view controller classes in my application delegate. I can change from
I have two view controllers in a tabbar which can both edit data. Therefore,

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.