I was trying to show some real time progress bar for a large json data, while it gets fully downloaded.
Is it possible?
I tried using XMLHttpRequest.
$.ajax({
xhr: function () {
var xhr = new window.XMLHttpRequest();
xhr.addEventListener("progress", function (evt) {
if (evt.lengthComputable) {
var percentComplete = evt.loaded / evt.total;
console.log(percentComplete);
}
}, false);
return xhr;
},
type: 'GET',
url: 'url',
data: {},
success: function (data) {
console.log("success")
}
});
Here, evt.lengthComputable is coming as false. Is there any way to show real time progress bar for json data?