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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:09:33+00:00 2026-05-15T01:09:33+00:00

I’m trying to implement a iGoogle like dashboard interface using widgets that get their

  • 0

I’m trying to implement a iGoogle like dashboard interface using widgets that get their content from other sites using JSONP calls.

The problem is that if the first widget that calls the “$.ajax” takes 8 seconds to get the content back, it seems that the callbacks of the other widgets will only be called after the callback of the first widget gets executed. For the user experience, it would be better if the widgets could be displayed as soon as they get the content back from the remote sites, and not wait for those that were scheduled before to complete.

Is there a way I can do that?

EDIT :
I use jquery 1.4.1.

I tested on Chrome and the behaviour seems to be different than on Firefox.

Here is a script that I’ve made up to try to get what happens :

  function showTime(add) { console.log(getTime() + ': ' + add); }
  function getNow() { return new Date().getTime(); }
  initialTime = getNow();
  function getTime() { return getNow() - initialTime; }
  function display(data) {  showTime('received a response'); }

  showTime("Launched a request");
  jQuery.getJSON("http://localhost:51223/WaitXSeconds/3?callback=?", display);
  showTime("Launched a request");
  jQuery.getJSON("http://localhost:51223/WaitXSeconds/4?callback=?", display);
  showTime("Launched a request");
  jQuery.getJSON("http://localhost:63372/WaitXSeconds/9?callback=?", display);
  showTime("Launched a request");
  jQuery.getJSON("http://services.digg.com/stories/top?appkey=http%3A%2F%2Fmashup.com&type=javascript&callback=?", display);
  showTime("Launched a request");
  jQuery.getJSON("http://www.geonames.org/postalCodeLookupJSON?postalcode=10504&country=US&callback=?", display);

The first three calls are just fake calls that wait the specified number of seconds.
Note that I use two different servers implementing this method.

Here is the result in the console on Firefox 3.6.2 :

0: Launched a request
3: Launched a request
6: Launched a request
11: Launched a request
14: Launched a request
3027: received a response
7096: received a response
9034: received a response
9037: received a response
9039: received a response

.. and here is the result in Chrome 4.1.249.1036 (41514) :

1: Launched a request
2: Launched a request
3: Launched a request
4: Launched a request
5: Launched a request
165: received a response
642: received a response
3145: received a response
7587: received a response
9157: received a response

It seems that in Firefox, the two requests to the two public APIs get called at the end, after all the other calls succeed.

Chrome, on the other hand, manages to execute the callback as soon as it receives the response.

On both browsers, when the request happen on the same server, they are not done in parallel. They are scheduled one after the other. But I guess this is a reasonable behaviour.

Can anybody explain Firefox’s behaviour or has any hack to go around this?

  • 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-15T01:09:33+00:00Added an answer on May 15, 2026 at 1:09 am

    In Firefox, if one of concurrent JSONP request isn’t finished, then all successive JSONP request aren’t executed, even if their responses have already arrived and written into these tags. This is because <script> tags, used by JSONP, executed synchronously in Firefox. So if one <script> isn’t finished, successive <script> tags aren’t executed, even if they are populated with response data.

    The solution is to wrap concurrent JSONP requests by iFrame. There is a project called jquery-jsonp that solves this issue.

    Here is a simplified version of iFramed JSONP:

    var jsc = (new Date()).getTime();
    function sendJsonpRequest(url, data, callback) {
        var iframe = document.createElement("iframe");
        var $iframe = jQuery(iframe);
        $iframe.css("display", "none");
        jQuery("head").append($iframe);
    
        var iframeWindow = iframe.contentWindow;
        var iframeDocument = iframeWindow.document;
    
        iframeDocument.open();
        iframeDocument.write("<html><head></head><body></body></html>");
        iframeDocument.close();
    
        var jsonp = "jsonp" + jsc++;
        var url = url + "?callback=" + jsonp;
        var params = jQuery.param(data);
        if (params) {
            url += "&" + params;
        }
    
        // Handle JSONP-style loading
        iframeWindow[jsonp] = function(data){
            if (callback) {
                callback(data);
            }
            // Garbage collect
            iframeWindow[jsonp] = undefined;
            try{ delete iframeWindow[jsonp]; } catch(e){}
            if (head) {
                head.removeChild(script);
            }
            $iframe.remove();
        };
    
        var head = iframeDocument.getElementsByTagName("head")[0];
        var script = iframeDocument.createElement("script");
        script.src = url;
    
        head.appendChild(script);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 438k
  • Answers 438k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Short answer; don't. You don't ever want to loop actively… May 15, 2026 at 4:42 pm
  • Editorial Team
    Editorial Team added an answer I don't think you want to bind to IsMouseOver on… May 15, 2026 at 4:42 pm
  • Editorial Team
    Editorial Team added an answer Use the onchange event in the select element: <select ...… May 15, 2026 at 4:42 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.