0

I'm making an AJAX HTTP POST request to an Python flask REST api. Can I get the percentage of the request completed?

Any suggestion using $ajax or $http?

I have tried the below code. I'm getting the values along with the response.

xhr.addEventListener("progress", function (evt) {
if (evt.lengthComputable) {
    var percentComplete = evt.loaded / evt.total;
    console.log(percentComplete * 100);
     $('.progress').css({
           width: percentComplete * 100 + '%'
     });
     if (percentComplete == 1) {
         $('.progress').addClass('hide');
     }
}
}, false);
return xhr;
Krishna
  • 1,089
  • 5
  • 24
  • 38

0 Answers0