0 votes
in AJAX by
Explain various ways open() method can be used for XMLHttpRequest.

1 Answer

0 votes
by

Open() method of XMLHttpRequest object help to initialize new request or existing request. The parameters it uses contains request method, URL and other optional attributes.

open ( method, URL )

The value for the method parameter can be “GET”, “POST”, or “HEAD”. “PUT” and “DELETE” are some methods used in RESTful requests.

URL is the string that has the path of HTTP server path for sending a request.

open (method, URL, async)

async – specifies if the request send should be handled asynchronously or not at the server. If the value of async is true, it means that after send() method the script processing should not wait for a response, false will mean the script will wait for a response before continuing for script process.

open (method, URL, async, userName)

username is optional for authentication. Its default value is null.

open (method, URL, async, userName, password)

password is optional for authentication. Its default value is null.

...