1

I would like to know if it is possible to create a progress bar for an AJAX call where data returned is a JSON Object which represents a large database . This functions is used to synchronize between a client - server side database, and would like to show progress for users, like a normal file download...

I have tried the following without sucesss..

$.ajax({
xhr: function() {
var xhr = new window.XMLHttpRequest();
xhr.addEventListener("progress", updateProgress, false);       

 function updateProgress (oEvent) {
      if (oEvent.lengthComputable) {
        var percentComplete = oEvent.loaded / oEvent.total * 100;
        console.log(percentComplete);
          } else {
         console.log('Unable to compute Size');
         }
    }
   return xhr;
    },
    type: "POST",
    url: "http:s......"
    ect....//
Awena
  • 1,002
  • 5
  • 20
  • 43

1 Answers1

0

Probably using - XMLHttpRequest I'm trying to achieve the same so digging it here. Does this post work for you?

Community
  • 1
  • 1
Hemant Tank
  • 1,724
  • 4
  • 28
  • 56