To send a request to a web server or service, open () methods and send () are used.

For example, to collect information "info.txt" file on our website.

xmlhttp.open("GET","info.txt",true); xmlhttp.send();

AJAX XMLHttp open()

The "open" method has three parameters: "method", "url", "async"


method: the type of request: GET or POST

url: the location of the file on the server

async: true (asynchronous) or false (synchronous)

AJAX XMLHttp send()

The send() method takes an optional parameter, used in POST requests to send any data to web service or server, for example, to search for any keyword.


Sends the request off to the server.

string: Only used for POST requests