What are the uses of XMLHTTPRequest Object in Ajax ?
In this article, we will know about the XMLHttpRequest and how it can be useful for the client-server request and properties of XMLHttpRequest.
Uses of XMLHTTPRequest object:
- It is used to make AJAX calls to exchange data from a remote web server.
- With the help of this object, users send requests to the server asynchronously and the server sends the data which we requested for ajax.
- XMLHTTPRequest object is used to prevent attacks from the server-side
- It is used in different protocols to make requests like HTTP, HTTPS, FTP, and FRPS.
- It is used to retrieve any type of data like XML, JSON, etc.
- With the help of this, there is no need to load the whole page it extracts some parts and does changes.
- It is used in data exchange with the help of API.
var objectname = new XMLHTTPRequest();
For detailed description about the XMLHttpRequest object methods & XMLHttpRequest object properties, please refer to the AJAX XMLHttpRequest Object article.
Example: This example describes how XMLHttpRequest is used in AJAX and utilizes the different XMLHttpRequest objects for making the request and getting a response from the server using JSON data.
Example 2: This example describes the XMLHttpRequest object by using the fetching the dog API.
Please Login to comment...