Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    907
    Thanks
    301
    Thanked 2 Times in 2 Posts

    Question jquery percentage completion

    Hi

    When making an AJAX call using jQuery, is it possible to know how much percentage has been completed so far?

    For example: 25%, 50% or 100%?

  • #2
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    No. The browser doesn't know how the total size of the response while receiving it.
    .My new Javascript tutorial site: http://reallifejs.com/
    .Latest article: Calculators — Tiny jQuery calculator, Full-fledged OOP calculator, Big number calculator
    .Latest quick-bit: Including jQuery — Environment-aware minification and CDNs with local fallback

  • Users who have thanked venegal for this post:

    phantom007 (11-15-2011)

  • #3
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    907
    Thanks
    301
    Thanked 2 Times in 2 Posts
    There must be some way because when you login to gmail, it shows a progressbar and increments the value of the meter according to the objects / elements rendered in the browser.

  • #4
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    Quote Originally Posted by cancer10 View Post
    Hi

    When making an AJAX call using jQuery, is it possible to know how much percentage has been completed so far?

    For example: 25%, 50% or 100%?
    Quote Originally Posted by cancer10
    There must be some way because when you login to gmail, it shows a progressbar and increments the value of the meter according to the objects / elements rendered in the browser.
    Are you sure gmail is using AJAX at that stage?

  • #5
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    907
    Thanks
    301
    Thanked 2 Times in 2 Posts
    If there is a mechanism to do this, it can be done using AJAX as well.

  • #6
    Banned
    Join Date
    Apr 2011
    Posts
    656
    Thanks
    14
    Thanked 69 Times in 69 Posts
    If there is a mechanism to do this, it can be done using AJAX as well.
    ok, then since there are plenty of examples on the www showing how to build progress bars (both client and server side), pick one and see if you can get it to work with AJAX since you are so sure it can be done.

  • #7
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    Quote Originally Posted by cancer10 View Post
    There must be some way because when you login to gmail, it shows a progressbar and increments the value of the meter according to the objects / elements rendered in the browser.
    The only two things you can do that will work in all browsers is split your request up into several smaller ones, so you can monitor how many of those have come back already, or regularly poll the server for a progress report. Whether any of those add to the user experience is doubtful.

    If you don't care about browser compatibility, there are several ways. If you make your server send a Content-Length header, so the browser actually knows what to expect, you can use the onprogress event of the XMLHttpRequest, if supported, or readystate 3, if supported.
    .My new Javascript tutorial site: http://reallifejs.com/
    .Latest article: Calculators — Tiny jQuery calculator, Full-fledged OOP calculator, Big number calculator
    .Latest quick-bit: Including jQuery — Environment-aware minification and CDNs with local fallback

  • Users who have thanked venegal for this post:

    phantom007 (11-15-2011)

  • #8
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    907
    Thanks
    301
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by webdev1958 View Post
    ok, then since there are plenty of examples on the www showing how to build progress bars (both client and server side), pick one and see if you can get it to work with AJAX since you are so sure it can be done.
    Yes there are scripts but they do not contain the logic that actually tells how much time is remaining or task completed.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •