在非浏览器环境比如nodejs中发起http请求能被称为ajax吗

AJAX即“Asynchronous JavaScript and XML”(异步的JavaScript与XML技术)

阅读 3.5k
2 个回答

一般来说,我们只把 XHR(XMLHttpRequest) 的请求成为 ajax。

但是当 fetch 发布后,我们一般把基于 xhr 的网络请求称为 传统 ajax,用于区分 fetch(fetch 不是基于
xhr)。

我们看 fetch 的描述:

The Fetch API provides a JavaScript interface for accessing and manipulating parts of the HTTP pipeline, such as requests and responses. It also provides a global fetch() method that provides an easy, logical way to fetch resources asynchronously across the network.

后面的意思是:跨网络异步获取资源

也许以后就没有 ajax 这种说法了。毕竟 ajax 中已经没有了 x。

wiki上其中两句

  1. AJAX 即 “Asynchronous JavaScript and XML”

  2. Ajax不需要任何浏览器插件,但需要用户允许JavaScript在浏览器上执行。

所以不叫 ajax


mdn 上也特别指出了jax里最重要的是 XMLHttpRequest object

Asynchronous JavaScript + XML, while not a technology in itself, is a term coined in 2005 by Jesse James Garrett, that describes a "new" approach to using a number of existing technologies together, including: HTML or XHTML, Cascading Style Sheets, JavaScript, The Document Object Model, XML, XSLT, and most importantly the XMLHttpRequest object.

也能说明其他环境下不算是ajax了 这个应该只是普通的http请求 跟浏览器发起请求来访问某个网站类似。


wiki: https://zh.wikipedia.org/wiki...
mdn: https://developer.mozilla.org...

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题