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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:38:59+00:00 2026-06-06T18:38:59+00:00

I am sourcing a large mapping/widget javascript file (1.3 MB) and wanted to display

  • 0

I am sourcing a large mapping/widget javascript file (1.3 MB) and wanted to display a progress bar as it loads. I know firebug’s net watch tab knows a lot of this information, but I would like something more lightweight. I came across this website:
http://blog.greweb.fr/2012/04/work-in-progress/

which almost gets me there except that I need to source the file I’m downloading. I didn’t see any listeners on jQuery’s getScript as the file downloads. Does anyone know how to get at the progress of a sourced file download?

Thanks in advance!

  • 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-06T18:39:00+00:00Added an answer on June 6, 2026 at 6:39 pm

    If you use getScript() you can execute a function using the success callback but that is only when the script has finished loading.

    I would recommend having a loading indicator image (you can find many at http://ajaxload.info/) and hiding it when the script has loaded.

    This SO has a couple of other ideas. One solution is below:

    var myTrigger;
    var progressElem = $('#progressCounter');
    $.ajax ({
        type            : 'GET',
        dataType        : 'xml',
        url             : 'somexmlscript.php' ,
        beforeSend      : function (thisXHR)
        {
            myTrigger = setInterval (function ()
            {
                if (thisXHR.readyState > 2)
                {
                    var totalBytes  = thisXHR.getResponseHeader('Content-length');
                    var dlBytes     = thisXHR.responseText.length;
                    (totalBytes > 0)? progressElem.html (Math.round ((dlBytes/ totalBytes) * 100) + "%") : progressElem.html (Math.round (dlBytes /1024) + "K");
                }
            }, 200);
        },
        complete        : function ()
        {
            clearInterval (myTrigger);
        },
        success         : function (response)
        {
            // Process XML
        }
    });
    

    This sets an interval to compute the progress by taking loaded bytes and total bytes. This might work for you.

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

Sidebar

Related Questions

Some issue arise when sourcing one of your env file (a series of variable
I've studied some CQRS sample implementations (Java / .Net) which use event sourcing as
I am sourcing a file in a bash terminal that needs to export some
I am trying a simple means of sourcing a file based on the filetype
I am trying a simple means of sourcing a file based on the filetype
I'm making my way into using Event Sourcing pattern, and there is one thing
I'm open sourcing my app, which was built in C# using Windows Forms. Are
I have my first CQRS project which uses event sourcing and I was wondering
We are trying CQRS and DDD and event sourcing. Let's say I have a
I've read up on Jonathan Oliver 's .NET EventStore library, and I must say

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.