Get size of file requested via ajax


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var xhr = $.ajax({
  2. type: "HEAD",
  3. url: "path/to/file.ext",
  4. success: function(msg){
  5. alert(xhr.getResponseHeader('Content-Length') + ' bytes');
  6. }
  7. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.