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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:40:24+00:00 2026-06-14T07:40:24+00:00

I have built a single page application where users can build reports. The users

  • 0

I have built a single page application where users can build reports. The users are presented with a form allowing them to choose the data source, the chart type and the theme, then upon confirmation the page loads the required files and draws the chart.

For better performance, I’d like to load the code modules and data in parallel. For example if the user selects “Pie chart”, “Blue theme” and “Airline Stats”:

WHEN (js module Pie chart is loaded)
and (blue theme css is loaded)
and (Airline Stats json is loaded)

THEN (draw chart)

I have found a number of libraries that implement AMD, and a number of libraries that implement promises, but none where module loading and promises could be combined as in my example above. Is this possible, and are there any libraries that already implement this?

My need is for client side JavaScript.

  • 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-14T07:40:26+00:00Added an answer on June 14, 2026 at 7:40 am

    jQuery can actualy do this through promises. It’s just a matter of modifying the code.

    Assuming that you own the code and all live in the same domain or if cross-domain, the server allows CORS, we will load each with .ajax(). We will then use .when() to detect when all the promises are loaded and .then() to add our callback to execute all the promises resolve.

    //you can provide a detailed setting for each using .ajax()'s second parameter
    //however, jQuery can "smart detect" the content's dataType
    
    var chart = $.ajax(urlOfChart), //script
        theme = $.ajax(urlOfTheme), //css
        data  = $.ajax(urlOfData);  //JSON
    
    //we use .when() to check when all three resolves
    //the arguments will be the jqXHR objects for the requests
    //in the order they were given in the argument list
    $.when(chart,theme,data).then(function(chart,theme,data){
    
        //according to jQuery.ajax(), if a script is requested, it is evaluated
        //and we still get it's plain text content
        //so with respect to the script, we do no processing
    
        //with the css, we get it as plain text since no dataType value handles it
        //we embed it into the DOM by creating a style element 
        //and append the text in it for the styles to take effect on the page
        $('<style type="text/css" />').html(theme).appendTo('head');
    
        //as for the JSON, jQuery converts it into an object 
        //and is passed as an argument as the return data for that promise
    
        //...everything is now requested, retrieved and prepared...
        //everything else goes under here
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have built a single page application using backbone js. I have separate backbone
I currently have a LARGE single-page application, with each html view being built purely
i have a web application that is build as single page. Through one user
I have built a game in HTML5 and a web form posts data to
I intend to build a web application where users can enter their time every
Hello all i have created a empty application instead of creating single page application
When I create a universal single-page application solution in MonoDevelop 3.0 the build fails
I am starting to build/design a new single page web application and really wanted
I have built a RIA on a single page. I am using Dojo 1.7.2.
I have a website built with jquery mobile(Single page). I have something like a

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.