Leran JavaScripts
Ajax XMLRequest
The XMLHttpRequest object is used to request data from a server.
Send a Request To a Server
To send a request to a server, we use the open() and send() methods of the XMLHttpRequest object:
Syntax for creating an XMLHttpRequest object:
xhttp.open("GET", "ajax_info.txt", true);
xhttp.send();
The url - to send Request
The url parameter of the open() method, is an address to a file on a server:
xhttp.open("GET", "ajax_info.txt", true);
The file can be any kind of file, like .txt and .xml, or server scripting files like .php
Asynchronous - True or False?
Server requests should be sent asynchronously.The async parameter of the open() method should be set to true:
xhttp.open("GET", "ajax_test.asp", true);