Tải bản đầy đủ (.pdf) (569 trang)

Prentice hall AJAX construction kit building plug and play AJAX applications jul 2007 ISBN 0132350084

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (5.15 MB, 569 trang )

NegusLiveLinuxSeriesAjaxConstructionKit:
BuildingPlug-and-PlayAjaxApplications
byMichaelMorrison
Publisher:PrenticeHall
PubDate:June29,2007
PrintISBN-10:0-13-235008-4
PrintISBN-13:978-0-13-235008-2
Pages:312
TableofContents|Index

Overview
SuperchargeYourSiteswithAjaxRightNow...No
ScriptingExpertiseNeeded!
You'veheardhowgreatAjaxis--howitcanhelpmakeyourWeb
sitesmoreusable,moreinteractive,moreresponsive,more
successful.AjaxConstructionKitletsyouputAjaxtowork
rightnow,evenifyou'veneverwrittenascript!Justlearnafew
essentials,checkoutafewexamples,thenruntheliveCDand
discoveralltheplug-and-playcodeyouneedtohittheground
running.AjaxConstructionKit'sbuilt-inapplicationswork
rightoutofthebox.AndwitheasyguidancefromMichael
Morrison,you'llgraduallydeepenyourunderstanding--learn
howtocustomize,extend,andreusetheseapplications--and
evenbuildskillsforcreatingnewones.Walkawayanexpert.
UseAjaxConstructionKit'stencompleteapplicationsto
DynamicallyloadWebdata
Dynamicallypopulatelists
TapintoRSSnewsfeeds
UseAutoCompletetoreduceinputerrors



CreatemoreresponsiveGUIswithreal-timevalidation
Buildakillerinterfaceforviewingimages
Presentinformationoradvertisingwithslickpop-ups
Provideanup-to-the-minuteweatherforecast
Buildane-commerceproductshippingcalculator
Addratingstoolstoyoursite
Andmore...
CD-ROMIncludes
YourcompleteAjaxprojects:RuntheAjaxprojects
(HTML,JavaScript,andPHPsourcecode)thatareincluded
ontheCDfromyourWindows,MacOSX,orLinuxsystem.
YourcompleteAjaxenvironment:BoottheCDasan
UbuntuLinuxliveCDtoimmediatelybeginworkingwiththe
Ajaxprojects(nosetuprequired).
Ready-to-runtoolsontheCDincludetheXAMPPWeb
server,FirefoxWebbrowser,andBluefishHTMLeditor.
SystemRequirements:
Platform:Windows,Linux,Mac(OSXorhigher)
Processor:Intel-basedprocessor(Pentiumorhigher)
Memory:128MBRAMormore
Diskspace:Nonerequired;USBthumbdriveoptionalto
storedata
Opticaldrive:CDreader
NegusLiveLinuxSeries
YourPractical,Hands-OnGuidestoGettingRealResultswith


FreeSoftware
Addthefreesoftwareandexamplesfromthebook'sCDtoyour
Windows,MacOSX,orLinuxsystemtofollowalongwiththe

projectsdescribedinthebook.OrboottheCDdirectlytousea
complete,prepackagedsetoffreesoftwaretoolstoplay,
display,andmodifythoseprojects.Startasanovice,bytrying
outexamples...andfinishwithprofessionalAjax-enabledWeb
content!
SERIESEDITORCHRISTOPHERNEGUSisthebestselling
authoroftheRedHatLinuxBibleseries,LinuxToysseries,and
thisseries'sflagshiptitle,LinuxLiveCDs.
Introduction1
PartIAjaxBootCamp
1AjaxandaBraveNewWorldWideWeb9
2InsideanAjaxApplication25
PartIIBuildingReal-WorldAjaxApplications
3DynamicallyLoadingWebData:AnXMLE-BookViewer
49
4UsingAjaxtoDynamicallyPopulateLists:AStock
Picker75
5TappingintoRSSNewsFeeds97
6ReadingtheUser'sMindwithAuto-Complete121
7CreatingResponsiveGUIswithReal-TimeValidation
139
8AKillerInterfaceforImageViewing159
9PresentingInformationwithSlickPopups171
10ForecastingtheWeatherwithAjax189


11BuildinganAjaxShippingCalculator205
12AddinganAjax-PoweredRatingSystemtoYourSite
231
PartIIIAppendices

AppendixAThePast,Present,andFutureofAjax257
AppendixBAQuickandDirtyXMLHttpRequestReference
261
AppendixCUsingtheLiveLinuxCD271


NegusLiveLinuxSeriesAjaxConstructionKit:
BuildingPlug-and-PlayAjaxApplications
byMichaelMorrison
Publisher:PrenticeHall
PubDate:June29,2007
PrintISBN-10:0-13-235008-4
PrintISBN-13:978-0-13-235008-2
Pages:312
TableofContents|Index

Copyright
NegusLiveLinuxSeries
Acknowledgments
AbouttheAuthor
Introduction
TheAudienceforThisBook
TheOrganizationofThisBook
AbouttheCD-ROMforThisBook
WhatYouNeedtoUseThisBook
PartI:AjaxBootCamp
Chapter1.AjaxandaBraveNewWorldWideWeb
DiningwithAjax
Ajax,Sting,andAsynchronicity
ToReload,orNotReload

WhatExactlyIsAjax?
Real-WorldAjax
AjaxIsn'tforEverything
TheShippingChargeCalculatorRevisited
Summary
Chapter2.InsideanAjaxApplication
TheNutsandBoltsofAjax


TheAjaxRequestLifecycle
GettingtoKnowtheAjaxToolkit
DismantlingtheE-BookViewer
CustomizingtheE-BookViewer
Summary
PartII:BuildingReal-WorldAjaxApplications
Chapter3.DynamicallyLoadingWebData:AnXMLE-Book
Viewer
TheChallenge:LoadingDatainSmallerChunks
TheDesign:DesigninganXMLE-BookViewer
PuttingTogethertheE-BookViewer
TestingBooker
GivingBookeranExtremeAjaxMakeover
Summary
Chapter4.UsingAjaxtoDynamicallyPopulateLists:AStock
Picker
TheChallenge:DisplayingSelectedStockInformation
TheDesign:DesigningaStockPicker
PuttingTogethertheStockPicker
TestingPicker
GivingPickeranExtremeAjaxMakeover

Summary
Chapter5.TappingintoRSSNewsFeeds
TheChallenge:QueryingNewsFeedsDynamically
TheDesign:DesigningaNewsFeedApplication
PuttingTogethertheNewsFeederApplication
TestingtheNewsFeeder
GivingNewsFeederanExtremeAjaxMakeover
Summary
Chapter6.ReadingtheUser'sMindwithAuto-Complete
TheChallenge:AnticipatingDataEntry
TheDesign:DesigninganAuto-CompleteApplication


PuttingTogethertheCompleterApplication
TestingCompleter
GivingCompleteranExtremeAjaxMakeover
Summary
Chapter7.CreatingResponsiveGUIswithReal-Time
Validation
TheChallenge:CheckingUserInputinRealTime
TheDesign:DesigningaValidatorApplication
PuttingTogethertheValidatorApplication
TestingValidator
GivingValidatoranExtremeAjaxMakeover
Summary
Chapter8.AKillerInterfaceforImageViewing
TheChallenge:LoadingImagesDynamically
TheDesign:DesigningaDynamicImageViewer
PuttingTogethertheImaginatorApplication
TestingImaginator

GivingImaginatoranExtremeAjaxMakeover
Summary
Chapter9.PresentingInformationwithSlickPopups
TheChallenge:CreatingLinkedPopups
TheDesign:DesigninganInformationPopupApplication
PuttingTogethertheInformerApplication
TestingInformer
GivingInformeranExtremeAjaxMakeover
Summary
Chapter10.ForecastingtheWeatherwithAjax
TheChallenge:GatheringDynamicWeatherInformation
TheDesign:DesigningaWeatherForecaster
PuttingTogethertheForecasterApplication
TestingForecaster
GivingForecasteranExtremeAjaxMakeover


Summary
Chapter11.BuildinganAjaxShippingCalculator
TheChallenge:RetrievingLiveShippingCharges
TheDesign:DesigningaShipperApplication
TheClientRequest
TheServerResponse
MakingSenseoftheClient-to-ServerConversation
PuttingTogethertheShipperApplication
TheShipperWebPage
TheShipperServerScript
TestingShipper
GivingShipperanExtremeAjaxMakeover
Summary

Chapter12.AddinganAjax-PoweredRatingSystemtoYour
Site
TheChallenge:AddingRatingstoaWebSite
TheDesign:DesigningaRaterApplication
PuttingTogethertheRaterApplication
TestingRater
GivingRateranExtremeAjaxMakeover
Summary
PartIII:Appendices
AppendixA.ThePast,Present,andFutureofAjax
TheRoadtoAjax
TheAjaxBoom
What'sNextforAjax?
AppendixB.AQuickandDirtyXMLHttpRequestReference
Methods
Properties
Events
AppendixC.UsingtheLiveLinuxCD


InsidetheLiveCD
RunningtheLiveCD
RunningtheLiveCDDirectlyonaWindowsPC
RunningtheLiveCDDirectlyonaMacPC
RunningtheLiveCDinOtherWays
Index


Copyright
Manyofthedesignationsusedbymanufacturersandsellersto

distinguishtheirproductsareclaimedastrademarks.Where
thosedesignationsappearinthisbook,andthepublisherwas
awareofatrademarkclaim,thedesignationshavebeenprinted
withinitialcapitallettersorinallcapitals.
Theauthorandpublisherhavetakencareinthepreparationof
thisbook,butmakenoexpressedorimpliedwarrantyofany
kindandassumenoresponsibilityforerrorsoromissions.No
liabilityisassumedforincidentalorconsequentialdamagesin
connectionwithorarisingoutoftheuseoftheinformationor
programscontainedherein.
Thepublisheroffersexcellentdiscountsonthisbookwhen
orderedinquantityforbulkpurchasesorspecialsales,which
mayincludeelectronicversionsand/orcustomcoversand
contentparticulartoyourbusiness,traininggoals,marketing
focus,andbrandinginterests.Formoreinformation,please
contact:
U.S.CorporateandGovernmentSales
(800)382-3419

ForsalesoutsidetheUnitedStates,pleasecontact:
InternationalSales

VisitusontheWeb:www.prenhallprofessional.com
LibraryofCongressCataloging-in-PublicationData
Morrison,Michael,1970Ajaxconstructionkit:buildingplug-andplayAjaxapplications/MichaelMorrison.
p.cm.
ISBN978-0-13-235008-


2(pbk.:alk.paper)1.Ajax(Websitedevelopmenttechnology)2.Web

3.JavaScript(Computerprogramlanguage)4.Asynchronoustransfermo
TK5105.8885.A52M672007
006.7'86—dc22
2007015375
Copyright©2008PearsonEducation,Inc.
Allrightsreserved.PrintedintheUnitedStatesofAmerica.This
publicationisprotectedbycopyright,andpermissionmustbe
obtainedfromthepublisherpriortoanyprohibited
reproduction,storageinaretrievalsystem,ortransmissionin
anyformorbyanymeans,electronic,mechanical,
photocopying,recording,orlikewise.Forinformationregarding
permissions,writeto:
PearsonEducation,Inc.
RightsandContractsDepartment
501BoylstonStreet,Suite900
Boston,MA02116
Fax(617)6713447
CDsoftwareislicensedundertheGNUPublicLicenseversion2
(GPLv2).
ISBN-13:978-0-13-235008-2
TextprintedintheUnitedStatesonrecycledpaperatRR
DonnellyinCrawfordsville,Indiana.
Firstprinting,July2007
Editor-in-Chief
MarkTaub
AcquisitionsEditor
DebraWilliamsCauley
DevelopmentEditor
SonglinQiu



ManagingEditor
GinaKanouse
ProjectEditors
MichaelThurston
BetsyHarris
CopyEditor
BartReed
Indexer
ErikaMillen
Proofreader
LeslieJoseph
TechnicalEditors
MarshaFlynt
JimLieb
PublishingCoordinator
KimBoedigheimer
MultimediaDeveloper
ChrisNegus
DanScherf
CoverDesign
AlanClements
Composition
JakeMcFarland

Dedication
Tomyhome-buildingmentor,DavidHill,whopatiently


guidedmethroughtheconstructionofourhomewhileI

attemptedtojuggleawritingcareerandfartoomany
sportsandhobbies.


NegusLiveLinuxSeries
Yourpractical,hands-onguidestogettingrealresults
withfreesoftware
Addthefreesoftwareandexamplesfromthebook'sCDtoyour
Windows,MacOSX,orLinuxsystemtofollowalongwiththe
projectsdescribedinthebook.OrboottheCDdirectlytousea
complete,prepackagedsetoffreesoftwaretoolstoplay,
display,andmodifythoseprojects.Startasanovice,bytrying
outexamples...andfinishwithprofessionalAjax-enabledWeb
content!
OverseeingtheseriesisChristopherNegus,bestsellingauthor
oftheRedHatLinuxBibleseries,LinuxToysseries,andthe
signaturebookforthisseries,LiveLinuxCDs.


Acknowledgments
I'dliketothankDebraWilliamsCauleyandthegoodfolksat
PrenticeHallformakingthisprojectareality,aswellasChris
Negusforbeingexcitedandsupportivefromtheget-go.
AhugethanksalsogoestomygoodfriendsStephenTallentand
FletcherMoore,whocamethroughmightilyinthemidnight
tech-supportdepartment,nottomentionpassingalonglotsof
goodideasandsharingtheirtimegenerously.
Andlastly,mywifedeservesthebiggestthanksofallforsimply
beingthecoolestpersonontheplanet,atleastinonenerd
writer'shumbleopinion.



AbouttheAuthor
MichaelMorrisonisawriter,developer,toyinventor,and
authorofavarietyofbookscoveringtopicssuchasJava,Web
scripting,gamedevelopment,andmobiledevices.Someof
Michael'snotablewritingprojectsincludeJavaScriptBible,6th
Edition(Wiley,2006),TeachYourselfHTMLandCSSin24
Hours,7thEdition(SamsPublishing,2005),BeginningMobile
PhoneGameProgramming(SamsPublishing,2004),andJava
Unleashed(SamsPublishing,1997).Michaelistheinstructorof
severalWeb-basedcourses,includingDigitalThink'sIntroduction
toJava2series,JavaBeansforProgrammersseries,andWin32
Programmingseries(www.digitalthink.com).
Inadditiontohisprimaryprofessionasawriterandtechnical
consultant,MichaelisthefounderofStalefishLabs
(www.stalefishlabs.com),anentertainmentcompany
specializingingames,toys,andinteractivemedia.Whennot
gluedtohiscomputer,skateboarding,playinghockey,or
watchingmovieswithhiswife,Masheed,Michaelenjoys
hangingoutbyhiskoipond.


Introduction
ThiswholebookideastartedasabetIhadwithmyeditorthat
wecouldn'tpicktworandomtechietopicsandtiethemtogether
inabook.Twodartsflewthroughtheairandthetopics"Ajax"
and"liveCDs"endedupbeingtheresult.Thisbookcould've
justaseasilybeenaboutBlu-rayonRailsoriPoddesign
patterns.Soit'sjustdumbluckthatyou'repickingupabookon

AjaxandliveCDs.
Andifyoubelievethat,maybeIcaninterestyouinhelping
fundthisstartupcompanyI'vebeenthinkingaboutlaunching!
Thetruthis,AjaxandliveCDsaresurprisinglygoodbedfellows
inthatliveCDsprovidetheperfectenvironmentforbuilding
andtestingAjaxapplications.Thewholeideaofa"liveCD"is
thatitincludesacompleteoperatingsystemonasingleCD.
Alongwithacompleteoperatingsystem,yougettoincludeany
applicationsyouwant,suchasaWebserverthatcanserveup
Ajaxapplications.
OnethingthatisuniqueaboutAjaxapplicationsascomparedto
purelyclient-sideapplicationsdevelopedsolelyinJavaScriptis
thattheyrequiresomethingtohappenontheserver.Inother
words,theverypremiseofAjaxiscommunicationbetweena
clientandaserver.Thismeansyounotonlyneedaserver,but
youneedaserverthatyouhaveabitofcontrolover.Atthe
veryleast,youneedtheabilitytoquicklyinstallandtest
server-sidescriptsthatwillhandletheserver-sideprocessing
foryourAjaxapplications.LiveCDsfitthebillnicelyintermsof
givingyouanunbelievablycustomizableplatformforbuilding,
testing,andhostingAjaxapplications.
AscoolasliveCDscanbe,Ihavetobehonestandsaythatthis
bookis95%aboutAjax.TheliveCDfacetofthisbookis
primarilyaconvenienceduetothefactthatAjaxapplications
aremoredemandingoftheirenvironmentthanpureclient
applications.


OK,sothebookisprimarilyaboutAjax,butwhatdoesthat
reallymean?Itmeansthatinarelativelyfewnumberofpages

youlearnhowtodothefollowingthingswithAjax:
Dynamicallyloade-bookchaptersforaWeb-basedbook
reader(Chapter3)
Instantlyselectandviewlivestockquotes(Chapter4)
TurnanyWebpageintoanewsaggregatorthat
understandsRSSnewsfeeds(Chapter5)
Addauto-completefunctionalitytoyourWebsite(Chapter
6)
Validateformdataandlookuplocationdatainrealtime
(Chapter7)
Createa"Web2.0"imageviewertomodernizetheway
yourpageshandleimages(Chapter8)
Useinformationalpopupwindowstodynamicallydisplay
smallnuggetsofcontent(Chapter9)
Addaliveweatherconditionpopupwindowtoanylink
(Chapter10)
CalculateshippingchargesontheflywithaU.S.Postal
ServiceAjaxrequest(Chapter11)
Incorporateananimatedfive-starratingsystemintoyour
Webpages(Chapter12)
ThesearethekindsofdynamicapplicationsthatAjaxmakes
possible.Moreimportantly,thisbookusesaconstructionkit
approachtoguidingyouthroughaddingthesefeaturestoAjax
applications.AlthoughyouwillultimatelylearnalotaboutAjax
asyouexplorethemanyexamplespresentedthroughoutthis
book,thefocusofthebookisnotonteachingyouAjax.The
focusisonshowingyouhowtodocoolthingswithAjax.
Sometimesthisrequiresyoutolearnsomethingentirelynew;



othertimesitsimplyrequirescuttingandpastingcode.The
pointisthatthisbookisaboutdoingthings.
Inmyopinion,doingislearning,soyou'llultimatelyleavethis
bookwithamuchmorethoroughunderstandingofAjaxthan
whenyoustarted.Butmoreimportantly,you'llleaveitwith
yourownsetofAjaxbuildingblocksthatyoucantakewithyou
andapplytoyourownprojects.

TheAudienceforThisBook
Iwon'tlietoyou—thisbookbyitsverynaturehastodelveinto
JavaScriptandPHPonaregularbasisasthevariousAjax
examplesarepresented.However,theoriginalgoalofthebook
wasforittobeapproachablebyanyonewithknowledgeof
HTMLandCSS(CascadingStyleSheets),andnotnecessarilya
backgroundinscripting,eitherclient(JavaScript)orserver
(PHP).I'mnotentirelysurethatwasarealisticgoal,butit
servedmewellintryingextremelyhardtopresentenoughAjax
coveragefortheexamplestomakesensebutnotsomuchto
scareawayscriptingnewcomers.
Allthatbeingsaid,youabsolutelymustknowathingortwo
aboutHTMLtotacklethisbook.CSSisn'tquiteascritical,butit
doescomeupfromtimetotime,soyoumightaswellconsider
abasicknowledgeofCSSaprerequisite.Fromthere,itwould
serveyouwelltoknowsomethingaboutJavaScriptbecauseitis
thebasisofAjax.However,Ibelieveyoucanduckandweave
yourwaythroughtheJavaScriptcodeinthisbookwithalimited
knowledgeofWebscripting,andstillleavewithatoolboxfullof
Ajaxgoodiesthatcanbereadilyreused.ThePHPcodethat
popsupthroughoutthebookisverysimple,andIexplain
exactlywhat'sgoingon,soyoucandefinitelygetbywithout

knowinganythingaboutPHP.


Introduction
ThiswholebookideastartedasabetIhadwithmyeditorthat
wecouldn'tpicktworandomtechietopicsandtiethemtogether
inabook.Twodartsflewthroughtheairandthetopics"Ajax"
and"liveCDs"endedupbeingtheresult.Thisbookcould've
justaseasilybeenaboutBlu-rayonRailsoriPoddesign
patterns.Soit'sjustdumbluckthatyou'repickingupabookon
AjaxandliveCDs.
Andifyoubelievethat,maybeIcaninterestyouinhelping
fundthisstartupcompanyI'vebeenthinkingaboutlaunching!
Thetruthis,AjaxandliveCDsaresurprisinglygoodbedfellows
inthatliveCDsprovidetheperfectenvironmentforbuilding
andtestingAjaxapplications.Thewholeideaofa"liveCD"is
thatitincludesacompleteoperatingsystemonasingleCD.
Alongwithacompleteoperatingsystem,yougettoincludeany
applicationsyouwant,suchasaWebserverthatcanserveup
Ajaxapplications.
OnethingthatisuniqueaboutAjaxapplicationsascomparedto
purelyclient-sideapplicationsdevelopedsolelyinJavaScriptis
thattheyrequiresomethingtohappenontheserver.Inother
words,theverypremiseofAjaxiscommunicationbetweena
clientandaserver.Thismeansyounotonlyneedaserver,but
youneedaserverthatyouhaveabitofcontrolover.Atthe
veryleast,youneedtheabilitytoquicklyinstallandtest
server-sidescriptsthatwillhandletheserver-sideprocessing
foryourAjaxapplications.LiveCDsfitthebillnicelyintermsof
givingyouanunbelievablycustomizableplatformforbuilding,

testing,andhostingAjaxapplications.
AscoolasliveCDscanbe,Ihavetobehonestandsaythatthis
bookis95%aboutAjax.TheliveCDfacetofthisbookis
primarilyaconvenienceduetothefactthatAjaxapplications
aremoredemandingoftheirenvironmentthanpureclient
applications.


OK,sothebookisprimarilyaboutAjax,butwhatdoesthat
reallymean?Itmeansthatinarelativelyfewnumberofpages
youlearnhowtodothefollowingthingswithAjax:
Dynamicallyloade-bookchaptersforaWeb-basedbook
reader(Chapter3)
Instantlyselectandviewlivestockquotes(Chapter4)
TurnanyWebpageintoanewsaggregatorthat
understandsRSSnewsfeeds(Chapter5)
Addauto-completefunctionalitytoyourWebsite(Chapter
6)
Validateformdataandlookuplocationdatainrealtime
(Chapter7)
Createa"Web2.0"imageviewertomodernizetheway
yourpageshandleimages(Chapter8)
Useinformationalpopupwindowstodynamicallydisplay
smallnuggetsofcontent(Chapter9)
Addaliveweatherconditionpopupwindowtoanylink
(Chapter10)
CalculateshippingchargesontheflywithaU.S.Postal
ServiceAjaxrequest(Chapter11)
Incorporateananimatedfive-starratingsystemintoyour
Webpages(Chapter12)

ThesearethekindsofdynamicapplicationsthatAjaxmakes
possible.Moreimportantly,thisbookusesaconstructionkit
approachtoguidingyouthroughaddingthesefeaturestoAjax
applications.AlthoughyouwillultimatelylearnalotaboutAjax
asyouexplorethemanyexamplespresentedthroughoutthis
book,thefocusofthebookisnotonteachingyouAjax.The
focusisonshowingyouhowtodocoolthingswithAjax.
Sometimesthisrequiresyoutolearnsomethingentirelynew;


othertimesitsimplyrequirescuttingandpastingcode.The
pointisthatthisbookisaboutdoingthings.
Inmyopinion,doingislearning,soyou'llultimatelyleavethis
bookwithamuchmorethoroughunderstandingofAjaxthan
whenyoustarted.Butmoreimportantly,you'llleaveitwith
yourownsetofAjaxbuildingblocksthatyoucantakewithyou
andapplytoyourownprojects.

TheAudienceforThisBook
Iwon'tlietoyou—thisbookbyitsverynaturehastodelveinto
JavaScriptandPHPonaregularbasisasthevariousAjax
examplesarepresented.However,theoriginalgoalofthebook
wasforittobeapproachablebyanyonewithknowledgeof
HTMLandCSS(CascadingStyleSheets),andnotnecessarilya
backgroundinscripting,eitherclient(JavaScript)orserver
(PHP).I'mnotentirelysurethatwasarealisticgoal,butit
servedmewellintryingextremelyhardtopresentenoughAjax
coveragefortheexamplestomakesensebutnotsomuchto
scareawayscriptingnewcomers.
Allthatbeingsaid,youabsolutelymustknowathingortwo

aboutHTMLtotacklethisbook.CSSisn'tquiteascritical,butit
doescomeupfromtimetotime,soyoumightaswellconsider
abasicknowledgeofCSSaprerequisite.Fromthere,itwould
serveyouwelltoknowsomethingaboutJavaScriptbecauseitis
thebasisofAjax.However,Ibelieveyoucanduckandweave
yourwaythroughtheJavaScriptcodeinthisbookwithalimited
knowledgeofWebscripting,andstillleavewithatoolboxfullof
Ajaxgoodiesthatcanbereadilyreused.ThePHPcodethat
popsupthroughoutthebookisverysimple,andIexplain
exactlywhat'sgoingon,soyoucandefinitelygetbywithout
knowinganythingaboutPHP.


TheOrganizationofThisBook
AlthoughthisbookfollowsthecharteroftheNegusLiveLinux
Seriestoprovidehands-onexperiencequickly,theorganization
ofthebookisslightlyunconventional.Thebookisdividedinto
threeparts:
PartI,"AjaxBootCamp"—Thispartofthebookwastes
notimelayingjustenoughgroundworksothatyouaren't
overwhelmedbytheintensityofthesampleAjax
applicationstocome.YouexploreseveralcommercialrealworldAjaxapplicationsandgetacquaintedwiththeAjax
ToolkitthatshipsontheaccompanyingCD-ROM.You'll
leavethispartofthebookrevveduptoseeAjaxinaction.
PartII,"BuildingReal-WorldAjaxApplications"—This
partofthebook,whichconstitutestheremainderofthe
book,isfocusedentirelyonusingAjaxtosolvereal-world
problems.FromdynamicallyresolvingaZIPcodeintoa
city/stateforadataentryform,toinjectinganinteractive
five-starratingsystemintoapage,thispartofthebook

wastesnotimeandtakesnoprisoners.Don'tgetme
wrong,it'sstillafunread,butdon'texpectabunchof
tutorialtalkoranessayonthehistoryofAjax.Thispartof
thebookinparticularisallaboutdoing!
PartIII,"Appendices"—Thispartprovidesadditional
informationyoumayfindhelpful.AppendixA,"ThePast,
Present,andFutureofAjax,"paintsapictureofwhereAjax
camefromandwhereit'sheaded.Thisisinnowaycritical
tounderstandinghowtoaddAjax-poweredfeaturestoyour
Webpages,butitdoesaddsomeperspectivetothebuzz
swirlingaroundAjaxthesedays.AppendixB,"AQuickand
DirtyXMLHttpRequestReference"isexactlythat—a
referencefortheJavaScriptobjectthatservesasthecore
ofAjax.Thisobjectisactuallyhiddenforthemostpart
throughoutthebookthankstotheAjaxToolkit,butifyou
everwanttodigdeeperintomycodeandmodifytheToolkit


itself,you'llneedtogettoknowtheXMLHttpRequest
object.
Finally,AppendixC,"UsingtheLiveLinuxCD,"isarguably
thehandiestofalltheappendixesbecauseitexplains
exactlyhowtousetheliveLinuxCDthatcomeswiththe
book.Don'tworryabitifyou'veneverusedorevenheard
ofaliveCD,anddon'tthinkyouneedtobeaLinuxexpert
orevenhaveLinuxinstalled.AppendixCaddressestherole
oftheliveCDandguidesyouthroughhowtouseitforyour
particularhardwaresetup.



AbouttheCD-ROMforThisBook
TheCD-ROMthatcomeswiththisbookiswhereliveCDsenter
intotheAjaxpicture.TheCDincludesabootableUbuntu(Linux
variant)operatingsystemthatincludestheApacheWebserver
andallofthesampleAjaxapplicationscoveredinthebook.
Perhapsmoreinterestingisthefactthatyoucanrunthe
applicationsdirectlyfromtheCDonceitbootsup,whichis
prettypowerfulconsideringthatyouwouldotherwisebe
requiredtohaveyourownWebserverupandrunning.
Thereareactuallyavarietyofdifferentwaysthatyoucan
accessandusetheAjaxsampleapplicationsontheliveLinux
CD.Youdon'tneedtohaveLinuxrunningonyourcomputer—all
youneedisacomputerwithaPentiumIIIorbetterprocessor.
TheliveCDcanberunfromWindows,MacOSX,oranother
Linuxvariant.TofindoutmoredetailsabouthowtousetheCD
toexploretheexampleapplications,checkoutAppendixC,
"UsingtheLiveLinuxCD."


×