Create AJAX Application
– Each time a user moves the finger away from a keyboard ajaxFunction() is called
– The onreadystatechange property stores the function that will process the response from a server.
The following code sets the onreadystatechange property and stores an empty function inside it:
This code sets the value of the “Time” input field equal to responseText:
– The readyState property holds the status of the server’s response.
Each time the readyState property changes, the onreadystatechange function will be executed.
Possible values for the readyState property:
0 The request is not initialized
1 The request has been set up
2 The request has been sent
3 The request is in process
4 The request is complete
– The data sent back from a server can be retrieved with the responseText property.
– The code in “time.asp” looks like this:
< % response.expires=-1 response.write(time) %>
– for html use “echo $response”