Step 1: Introduction to AJAX
AJAX is a popular technique as it reduces the overhead of reloading webpages again and again. It is being used by many of the famous applications. Some of the popular applications that use AJAX are Google, Facebook and YouTube.
Step 2: Combination of Internet Standards
Step 3: Prerequisites of AJAX
Step 4: Make an HTTP Request to the Server
Step 5: Response Function for the HTTP Request
Step 6: Set a reference
Step 7: Make a request to the server using open and send methods
With that done, we will be sending a request to the server. Over here, we need to use both the send and open methods within the HTTP class to achieve this. The first parameter can either be Post or Get, depending upon your requirements. With the first parameter set, we will move on to the next parameter which allows you to open the URL you are targeting. The third and the optional parameter will be set as true to ensure the method is called asynchronously. The parameter over here being used to send the data will retrieve any data needed to be sent to the server. Over here, the data will be sent over using the POST request. The data should be in a format that can be easily parsed, such as a query string, or in JSON or SOAP format.
Step 9: Check Server response
The state values range from 0 to 4, each with a distinct ready state. Over here, the value retrieved should be 4. This will mean that the response is working correctly and has retrieved the required data. With that done, the processing will have to be started next.
Step 10: Obtain Data sent by server