AJAX Introduction by Bhanwar Gupta - HTML preview
Download the book in PDF, ePub, Kindle for a complete version.
AJAX Changes How Web Apps are Built
Components & Events
Order EntryItem List Component
ErrorViewer Item List (DIV) (DIV) Events/Actions
Validation
Shopping Cart (DIV)
Persistence
Shopping Cart Component
Event Handlers Shipping Form (DIV) GUI Creation
Shipping Component
Billing Form (DIV)
Unit of work is a component Three-Tier Client/Server Model Client code has validation, flow, layout, data interchange No submit buttons—save buttons
Only parts of pages are updated at a time
AJAX -- Message Flow
<script type=“text/javascript”>
XMLHttpRequest
function handleResponse() { …read response from server …get a handle to the DIV If Not OK
Replace DIV contents with msg }Message
name=bhanwar Or
<name>Bhanwar</name>
function checkName( name ) { …initialize request (url, parms) …register callback function …call the server
}
Message
status=999
msg=Not a valid name
ValidateName( req, res…) { parse request
lookup name in database is it valid?
if so, return OK otherwise
return error message
Save<div id=status>Not a Valid NameClient/Browser
Server
