Difference between AJAX request and a regular browser request(AJAX 请求和普通浏览器请求的区别)
问题描述
AJAX 请求和直接浏览器请求之间有区别吗(就网页的调用和加载方式而言)?
Is there a difference between an AJAX request and a direct browser request (in terms of how a web page is called and loaded)?
换句话说,我的意思是:直接服务器端请求的处理方式是否不同于客户端请求(由浏览器发起)?
In other words, I mean: is a direct server-side request handled in any way differently than a client-side request (initiated by the browser)?
推荐答案
就服务器而言,AJAX 请求与正常"浏览器请求相同,除了可能略有不同的 HTTP 标头.例如chrome 发送:
An AJAX request is identical to a "normal" browser request as far as the server is concerned other than potentially slightly different HTTP headers. e.g. chrome sends:
我不确定该标头是否标准化,或者它是否在每个浏览器中都不同,甚至是否在每个浏览器中都包含 .
I'm not sure if that header is standardized or not, or if it's different in every browser or even included at all in every browser.
我收回这一点,该标头是由 jQuery(可能还有其他 JS 库)发送的,而不是由浏览器发送的,如下所示:
edit: I take that back, that header is sent by jQuery (and likely other JS libraries), not the browser as is evidenced by:
发送:
这使我得出结论,默认情况下绝对没有区别.
which leads me to the conclusion that by default there is absolutely no difference.
这篇关于AJAX 请求和普通浏览器请求的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!