Section 2.24. Giving instructions to the browser


2.24. Giving instructions to the browser

Next we need to tell the browser what to do when it gets a response from the server. Remember, the browser will run the function we tell it about every time the ready state changes.

     function getCustomerInfo() {       var phone = document.getElementById("phone").value;       var url = "lookupCustomer.php?phone=" + escape(phone);       request.open("GET", url, true);       request.onreadystatechange = updatePage;Here's the name of the function that the browser should run whenever the ready state of the request object changes.       request.send(null)  ;Be sure you set the onreadystatechange property before calling send(),   so the browser knows what to do when it gets a response.     } 




Head Rush Ajax
Head Rush Ajax (Head First)
ISBN: 0596102259
EAN: 2147483647
Year: 2004
Pages: 241

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net