Ajax如何獲取響應內容長度?對于這個問題是不是都很多小伙伴們都想要了解呢?那么今天小編就為大家介紹Ajax獲取響應內容長度的技巧,感興趣的小伙伴們不妨收藏起來吧。
var xhr = $.ajax({ type: "HEAD", url: "path/to/file.ext", success: function(msg){ alert(xhr.getResponseHeader('Content-Length') + ' bytes'); }});
本文就是關于Ajax如何獲取響應內容長度,此方法還涉及到了Ajax調用成功后返回方法的使用技巧,非常值得大家學習!
新聞熱點
疑難解答
圖片精選