Ajax steps:
基本步骤:
• JavaScript
– Define an object for sending HTTP requests
– Initiate request
• Get request object
• Designate an anonymous response handler function
– Supply as onreadystatechange attribute of request
• Initiate a GET or POST request to a servlet
• Send data
– Handle response
• Wait for readyState of 4 and HTTP status of 200
• Extract return text with responseText or responseXML
• Use innerHTML to insert result into designated element
• HTML
– Load JavaScript from centralized directory. Use style sheet.
– Designate control that initiates request
– Give id to output placeholder region