Home > Web Front-end > JS Tutorial > Ajax method to get response content length

Ajax method to get response content length

亚连
Release: 2018-05-25 10:36:42
Original
1742 people have browsed it

This article mainly introduces the method of Ajax to obtain the response content length, and involves the use skills of the return method after the Ajax call is successful. It has certain reference value. Friends in need can refer to it.

The examples of this article are described Ajax method to get response content length. Share it with everyone for your reference. The details are as follows:

var xhr = $.ajax({
 type: "HEAD",
 url: "path/to/file.ext",
 success: function(msg){
  alert(xhr.getResponseHeader('Content-Length') + ' bytes');
 }
});
Copy after login

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Detailed explanation of ajax jtemplate to implement dynamic paging

A simple implementation of Ajax showing progress during the request process

JQuery Ajax dynamically generates Table

The above is the detailed content of Ajax method to get response content length. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template