XMLHTTP Open () method

Source: Internet
Author: User
Keywords Nbsp; xml http Server if
Tags address authentication example get http http request information send

Open
Creates a new HTTP request and specifies the method, URL, and authentication information for this request

Syntax
Oxmlhttprequest.open (Bstrmethod, bstrURL, Varasync, Bstruser, bstrpassword);

Parameters
Bstrmethod
HTTP methods, such as POST, get, put, and propfind. Not sensitive to case.

bstrURL
The URL address of the request, which can be either an absolute address or a relative address.

varasync[Optional]
Boolean specifying whether this request is asynchronous and true by default. If true, the callback function specified by the onReadyStateChange property is invoked when the state changes.

bstruser[Optional]
If the server requires authentication, the user name is specified here, and if not specified, the validation window pops up when the server needs to authenticate.

bstrpassword[Optional]
The password portion of the authentication information, which is ignored if the user name is empty.

Example
The following example demonstrates requesting book.xml from a server and displaying the book field in it.

Java code var xmlhttp = new ActiveXObject ("msxml2.xmlhttp.3.0");   Xmlhttp.open ("Get", "http://localhost/books.xml", false);   Xmlhttp.send ();   var book = Xmlhttp.responseXML.selectSingleNode ("//book[@id = ' bk101 ']"); alert (book.xml);


Notes
After calling this method, you can call the Send method to send data to the server.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.