XMLHttpRequest.open() - Web APIs 编辑

The XMLHttpRequest method open() initializes a newly-created request, or re-initializes an existing one.

Note: Calling this method for an already active request (one for which open() has already been called) is the equivalent of calling abort().

Syntax

XMLHttpRequest.open(method, url[, async[, user[, password]]])

Parameters

method
The HTTP request method to use, such as "GET", "POST", "PUT", "DELETE", etc. Ignored for non-HTTP(S) URLs.
url
A DOMString representing the URL to send the request to.
async Optional
An optional Boolean parameter, defaulting to true, indicating whether or not to perform the operation asynchronously. If this value is false, the send() method does not return until the response is received. If true, notification of a completed transaction is provided using event listeners. This must be true if the multipart attribute is true, or an exception will be thrown. Note: Synchronous requests on the main thread can be easily disruptive to the user experience and should be avoided; in fact, many browsers have deprecated synchronous XHR support on the main thread entirely. Synchronous requests are permitted in Workers.
user Optional
The optional user name to use for authentication purposes; by default, this is the null value.
password Optional
The optional password to use for authentication purposes; by default, this is the null value.

Specifications

SpecificationStatusComment
XMLHttpRequest
The definition of 'open()' in that specification.
Living StandardWHATWG living standard

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:50 次

字数:4031

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文