Before sending any AJAX request, an XMLHttpRequest object must be created.
This object acts as a communication channel between the browser and the server.
Without this object, AJAX cannot work.
The XMLHttpRequest constructor creates a new request instance.
Each request must have its own XMLHttpRequest object.
After creating the object, the next step is to configure the request.
This is done using the open method.
The open method defines three important things.
First is the HTTP method such as GET or POST.
Second is the server file or API URL.
Third defines whether the request runs asynchronously.
Once the request is configured, it is sent to the server using the send method.
For GET requests, send is called without data.
For POST requests, data can be sent inside the send method.
This is commonly used in form submission.
After sending the request, the browser waits for the server response.
When the response arrives, it can be accessed using responseText.
Each XMLHttpRequest object follows the same lifecycle.
Create object, open connection, send request, receive response.
Understanding object creation and request flow is essential before learning readyState and status handling.