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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:35:00+00:00 2026-06-10T22:35:00+00:00

So I have this dilemma, where I have a backbone view that creates a

  • 0

So I have this dilemma, where I have a backbone view that creates a subviews that will be appended to the main view. Each of these subview have to make a ajax call that will retrieve data to complete the subview. Now the super view calls each subviews render and a appends it to itself. I then take the element of the main view and post it to a server, the problem is the ajax are finish after I sent the post to the server. Is there a better way to structure this work with asynchronous calls? I have this working with synchronous but the load bar doesn’t even show up.

So here is example of what it is like:

WebView
generate:function(){
    var html = new MainView().render().el
    //ajax post to server with html
}

MainView 
    initalize:
    render:function(){
        this.el.append(new Subview().render().el);
    }

Subview
    initialize:
    render:fucntion(){
        //ajax - with  a success that alters the el
        return this;
    }

Now the generate function finishes before I can even get the data back from the calls and I cant bind to anything because the data is already sent to the server.

  • 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-10T22:35:01+00:00Added an answer on June 10, 2026 at 10:35 pm
    MainView
    childViews = [];
    renderCompletedChildViews = 0;
    addChildView: function () {
       var subView = new SubView();
       this.childViews.push(subView);
       subView.on("renderComplete", postToServer, this);
    }
    render: function () {
       for( var i=0; i<this.childViews.length; i++ ) {
            this.childViews[i].render(this.el);
       }
    }
    postToServer: function () {
       this.renderCompletedChildViews++;
       if( this.renderCompletedChildViews == this.childViews.length) {
           // Interact with server
       }
    }
    
    
    SubView
    render: function (el) {
       // Make an ajax call, on receiving data append the data to el passed by parent view and trigger "renderComplete" on current instance
    }
    

    This way, you have made the code completely event driven and asynchronous.

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

Sidebar

Related Questions

Basically my dilemma is this. I have a list of x servers that host
My dilemma is this: I have a PHP page with a form that includes
Okay, my dilemma is this. I have an admin page that I use to
I have this dilemma many times - and I would like one time and
We have a dilemma; developing desktop application using Matisse or Jigloo.. Matisse has this
This is my dilemma. I have a RollingFileAppender . I have a BufferingForwardingAppender .
I'm having something of a dilemma and would appreciate some input. I have this
I have a dilemma with this one. With the following code I am able
I have a slight dilema. This isn't general to backbone.js but it's certainly causing
If you could help me with this dilemma I have. Now, I know C

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.