var xhr = $.ajax({ type: "HEAD", url: "path/to/file.ext", success: function(msg){ alert(xhr.getResponseHeader('Content-Length') + ' bytes'); } });
当前位置:主页 >> JavaScript >> 正文
ajax获取响应长度,来判断是否灌水
阅读:4349 输入:2015-10-17 15:04:08
var xhr = $.ajax({ type: "HEAD", url: "path/to/file.ext", success: function(msg){ alert(xhr.getResponseHeader('Content-Length') + ' bytes'); } });