jQuery的 - 如何检查响应对象的大小AJAX调用?大小、对象、jQuery、AJAX

2023-09-10 14:42:35 作者:诺贝尔可爱奖

我想知道响应Ajax调用的大小(以千字节/字节)(不用彷徨,。员额,阿贾克斯) - 任何想法

I want to know the size (in kbyte / byte) of the response to an ajax call (.get, .post, .ajax) - any ideas?

谢谢!

推荐答案

我想你最好检查这个尺寸在浏览器的调试工具。可以得到的数据长度,所建议的约翰里奇,但这只是字符长度。此数据的实际字节大小独自可能会发生变化,这取决于使用的编码。然后,你也有你的头。

I figure you 's best check this size in the debugger tools of your browser. You can get the data length, as suggested by John Riche, but this is only the character length. The actual byte size of this data alone may vary, depending on the used encoding. And then you got your headers too.

不幸的是我认为你不能读取的Javascript本身的信息。

Unfortunately I think you cannot read this information from Javascript itself.

如果您使用Chrome,preSS F12打开开发工具,并选择网络,你会得到请求的概述,包括AJAX请求。对于每个请求有双方的响应内容和整个响应一个字节大小。 萤火虫,你应该能看到类似的数据。

If you use Chrome, press F12 to open the development tools, and choose 'Network', you get an overview of requests, including AJAX requests. For each request there's a byte size of both the response content and the entire response. In FireBug you should be able to see similar data.