The second parameter is the URL you're sending the request to. You have two options to access that data: httpRequest. In the following example, we differentiate between a successful and unsuccessful AJAX call by checking for a OK response code. To mitigate this problem, you could wrap your if Whereas, the POST method is used to send large amount of data, such as form data.
This article guides you through the AJAX basics and gives you two simple hands-on examples to get you started.
Ajax get request
The following illustrations demonstrate how Ajax communication works: Since Ajax requests are usually asynchronous, execution of the script continues as soon as the Ajax request is sent, i. Also, the function assigned to the onreadystatechange event handler called every time the readyState property changes.
based on 17 review