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

Ajax method to get response content length

亚连
亚连Original
2018-05-25 10:36:421649browse

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');
 }
});

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!

Statement:
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