Sie sind auf Seite 1von 14

synchronous avascript nd ML

By Vitthal M. vitthalt@karmic.co.in

Introduction of AJAX
AJAX is not programming language / technology. It is a methodology on using several web technologies together , it is just a style of design, Ajax is a design approach and a set of techniques for creating a highly interactive user experience for web application. Why AJAX? Reduce network Traffic Increase Speed Enhance User Experience

The Core Components


HTML and CSS : For presenting JavaScript : For local Processing Document Object Model ( DOM ) : To Access Data inside the page or to access elements of an XML file on the Server. XMLHttpRequest Java Script communication directly with the server, through the Java Script XMLHTTPRequest. A WEB page can make a request to, and get response from a web server Without reloading the page.

Ajax is a technique for creating fast and dynamic web pages Its Allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. ( This means that it is possible to update parts of web page, without reloading the whole page

AJAX is based on Javascript, and the main functionality is to access the web server inside the Javascript code. Access to the server using special objects; we send data and retrieve data. When user initiates an event, a javascript function is called which accesses server using the objects. The received information is shown to the user by means of the Javascripts functions.

Recall the standard HTTP transaction 1. Client Open connection to server 2. Client sends request to server 3. Server sends reply to client 4. Client and server close connection Transaction Event 1. User trigger some event ( Presses a key, moves mouse) 2. Event Handler code sends HTTP request to server 3. Server replies triggering code on client 4. Reply handler code updates web page using servers reply

Synchronous Asynchronous

Script stops and waits for the server to send back a reply before continuing Like reloading the page but with only the requested information having to be download instead of the entire page Faster then not using AJAX

Script Allows the page to continue to be processed and will handle the reply if and when it arrives. Avoid the delay while the retrieval from the server

GET POST

Purpose of GET : To Get Information, intended to be used when you are reading information to display on the pages Browsers will automatically cache the result from a GET request and if the same GET request is made again then they will display the cached result rather then rerunning the entire request. A GET call is retrieving data to display in the page and data is not expected to be changed on the server by such a call and re-requesting the same data should be expected to obtain the same result

Post method is intended to be used where you are updating information on the server. Results returned from server. Always obtain the response from the server. Rather then keeping a cached copy of the prior response.

Das könnte Ihnen auch gefallen