Vous êtes sur la page 1sur 19

Using XHR

<p>Enter customer ID number to retrieve information:</p> <p>Customer ID: <input type=" text" id=" txtCustomerId" value="" /></p> <p><input type=" button" value=" Get Customer Info" onclick=" requestCustomerInfo()" /></p> <div id=" divCustomerInfo"></div>

Cont..
fuction requestCustomerInfo() { var sID = document.getElementById(txtCustId).value; var oXHR = zXmlHttp.createRequest(); oXHR.open(get, GetCustomerData.php?id= + sId, true); oXHR.onreadystatechange = function () {
if (oxmlHttp.readyState == 4) { if(oXHR.status == 200 || oXHR.status == 304) { displayCustomerInfo(oXHR.responseText); } else { displayCustomerInfo(An error occurred: + oXHR.statusText);

} }; oxmlHttp.send(null);

Cont..
function displayCustomerInfo(sText) { var divCustomerInfo = document.getElementById("divCustomerInfo"); divCustomerInfo.innerHTML = sText;

Server status codes


Most common status codes are:
200 (OK) 201 created 204 no content 205 reset content 206 partial content

06CS832 RICH INTERNET APPLICATIONS WITH

304 (NOT MODIFIED) 400 BAD REQUEST 401 (UNAUTHORIZED) 403 (FORBIDDEN) 404 (NOT FOUND) 405 METHOD NOT ALLOWED 406- NOT ACCEPTABLE 407- PROXY AUTHENTICATION REQUIRED

Contd..

06CS832 RICH INTERNET APPLICATIONS WITH

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

10

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

11

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

12

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

13

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

14

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

15

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

16

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

17

synchronous communication

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

18

Asynchronous communication and AJAX application model

BUILDING RICH INTERNET APPLICATIONS WITH AJAX-2:

06IS832/WEB 2.0 AND RICH INTERNET APPLICATIONS

19