XMLHttpRequest Methods: open()

By: Dusty Arlia
Published on Friday, October 10, 2014 at 3:16 PM
Last Updated on Tuesday, July 14, 2015 at 2:13 AM
Total Updates: 3

The open() method of the XMLHttpRequest object is used to create an HTTP request. This method takes 2 or more arguments. The first parameter takes the HTTP request method. The second parameter takes the URL to fetch. Here is the basic syntax:

request.open("[GET or POST]", "[url to fetch]")

The third argument to open() is optional. This argument indicates whether this request should be handled synchronously or asynchronously. The default is asynchronously.

The fourth and fifth arguments can be used to specify an Authorization HTTP header if you are requesting a password protected URL.

Comments:

Ad: