What is AJAX?
AJAX is not a programming language.
AJAX just uses a combination of:
- A browser built-in
XMLHttpRequestobject (to request data from a web server)
AJAX can be used for interactive communication with an PHP, .ASP, Databases, XML file,
Here i am showing use of AJAX for interactive communication with an XML file.
Inside my .xml
Inside .js we used few methods of AJAX :
- Creates a new XMLHttpRequest object
- Returns specific header information
open(method, url, async)
- Specifies the request
Also we used few property of AJAX :
- Defines a function to be called when the readyState property changes
- Holds the status of the XMLHttpRequest.
- 0= request not initialized
- 1= server connection established
- 2= request received
- 3= processing request
- 4= request finished and response is ready
- Returns the response data as a string
- Returns the response data as XML data
- Returns the status-number of a request
- 200= "OK"
- 403= "Forbidden"
- 404= "Not Found"
For a complete list go to the Http Messages Reference
Why use AJAX?
AJAX allows web pages to be updated asynchronously by exchanging data with a web server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.
For more query visit w3schools AJAX
Hope this will help you <3