8
I want to get the value of the percentage of an ajax request on an external server. How to do?
$("#uptade_space_disk").click(function(){
var url = "/calcular-espaco-em-disco"
jQuery.ajax({
url: url,
dataType: 'script',
beforeSend: function() {
$("#loader").show();
$("#uptade_space_disk").hide();
},
success: function() {
},
error: function() {
}
});
})
Gustavo, you’ve got a problem there. I put console.log(Math.round(evt.Loaded*100/evt.total) + '%') and it only shows when it is 100% and has not updated #Loader.. what is?
– Jefferson Alison
Not every browser supports this event (in fact only today I learned that it exists). About update the
#loader
I gave a kick about how your code is organized, anything try to use.html()
.– Gustavo Rodrigues