Ajax - Ajax Ajax uses instances of a special object...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Ajax Ajax uses instances of a special object XMLHttpRequest. We’ll defer for the moment how to get such an instance; suppose for now we have an instance ‘request’. Using ‘request’ to call the server request.open(“GET”, url , true); Prepares a request to the URL url using GET method to be processed asynchronously (false => synchronously) NOTE: URL must be from the same server! request.onreadystatechange = function; When server state changes, call the function function . Sometimes referred to as the “callback” function. request.send(null); Make the request to the server. Getting information back from the server request.readyState Contains integer 1-4: is 4 when server has finished processing the request request.responseText The contents of the URL url from the server.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The autocompletion example The HTML file <form action="ordersubmit.php" method="post"> <table> <tr> <td>Your email address:</td> <td><input id="email" type="text" name="email" size="40" /></td> </tr> <tr> <td>Your shipping preference:</td>
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/01/2008 for the course INFO 2300 taught by Professor Williamson during the Spring '08 term at Cornell University (Engineering School).

Page1 / 7

Ajax - Ajax Ajax uses instances of a special object...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online