I have been searching and manipulating some xhr ajax things, but I have still not found any solution to this.
What I have is a content loaded in AJAX in jQuery.
What I want to do is to display a percentage loader. I already set beforeSend
with a loading icon, but as I have a lot of data (text), my clients thinks it's stuck...
I already tried this, and this, but it only displays the percentage when everything is already loaded (so it displays 100%
), but that's because the communication between client-server isn't persistent I guess.
Is there a way to do this using PHP and jQuery ? If not, how can I do this ?
Here's my code :
$.ajax({
url: ajax_var.url,
type: 'POST',
data: dataString,
beforeSend: function() {
$("#loader").html("<i class='loading icon'></i> Loading...");
},
success: function(data) {
$("#loaded_data").html(data);
},
error: function(e) {
console.log(e);
}
});
Thanks