AJAX là viết tắt của Asynchronous JavaScript And XML. AJAX là một kiểu lập trình trở nên phổ biến vào năm 2005 (với Google Suggest). AJAX không phải là một ngôn ngữ lập trình mới mà là một cách thức. | Asynchronous JavaScript and XML AJaX Object Computing Inc. Mark Volkmann mark@ LI AJaX Topics Covered What is AJaX JavaScript Overview XMLHttpRequest XHR Sarissa JavaScript Library REST Overview Demo Description Demo Sequence Diagrams Demo REST Server Demo XHTML Demo JavaScript Wrapup AJaX 1 What is AJaX A name given to an existing approach to building dynamic web applications Web pages use JavaScript to make asynchronous calls to web-based services that typically return XML - allows user to continue interacting with web page while waiting for data to be returned - page can be updated without refreshing browser - results in a better user experience - there are AJaX libraries that reduce the amount of JavaScript code that must be written Uses a JavaScript class called XMLHttpRequest 3 AJaX A Good Acronym A is for asynchronous - requests can be made asynchronously or synchronously - both techniques allow web page to be updated without refreshing it - anything useful the user can do while processing request if yes then use asynchronous otherwise use synchronous J is for JavaScript - typically JavaScript is used on the client-side in the browser only programming language supported out-of-the-box by most web browsers - can use any language on server-side that can accept HTTP requests and return HTTP responses Java servlets Ruby servlets CGI scripts . X is for XML - request and response messages can contain XML can easily invoke REST-style services .x B - can really contain any text single text value delimited text . . I 4 AJaX 2 Uses For AJaX Asynchronous - examples Google Maps http maps . google . com - asynchronously loads graphic tiles to support map scrolling Google Suggest http www . google . com suggest asynchronously updates list of possible topic matches based on what has been typed so far Synchronous - even when there is nothing useful for the user to do after a request is submitted to a server AJaX can be used to retrieve data and update selected .