Dear 'Ajax in Action' Readers,
This zip file gathers together the source code for the examples in the 'Ajax in Action' book. Code is organized by chapter, and, within each chapter, subfolders for the original and the refactored versions of the example. The folder 'video' contains the code examples created for the 'Ajax in Action' video that can be downloaded from Manning's web site.
Chapter 1: has no code in it, so nothing to see here!
Chapter 2: Folder ch02 contains the CSS examples from this chapter. The stylesheet for the minimal 'skeleton' look can be swapped in by changing the commented-out <link> tag.
Chapter 3: Folder ch03 contains the initial ContentLoader object, and the Rico accordion example
Chapter 4: Folder ch04 contains both versions of the 'mousemat' example, and both versions ofthe 'musical keys' example.
Chapter 5: Folder ch05 popups.html is the entry point for the various data retrieval examples. Swap in the commented-out <script> tags in lines 14-18 to run the examples using Content-centric, Script-centric (iframe), script-centric (eval), and Data-centric (XML or JSON) approaches.planets.html shows the Object BRowser in action.
Chapter 6: ch06/msgtest.html is the entry point for the main notification system example in this chapter. ch06/planets.html revisits the example from chapter 5, with inline notifications added in.
Chapter 7: ch07/googleSoap.html is the google guessing game example used to illustrate web services and the server-of-origin policy. Noter that you'll need to get your own googfle API license key as described in the book, if you want to run this example, and add it to the html file at line 12.
Chapter 8: Folder ch08 contains the examples here. domtree_profiled.html, dotnotation_profiled.html and loop_profiled.html are the tests of conventional javascript wisdom. mousemat_profiled.html applies the profiler to the mousemat example from chapter 4. clickbox.html is the performance example.
AJAX BY EXAMPLE: Chapters 9-13 (Folders ch09 - ch13)
We've picked a variety of server technologies - VB.Net, C#, PHP and Java (and the video is backed by some Perl scripts) - and getting all the back-end data feeds working can be a daunting task, as our proof-readers can attest! It may be that you want to get the full example working end-to-end, or it may be that you want to focus on what the client code (i.e. the JavaScript) is doing. To this end, we've provided a set of mock data to run each client against, as well as the live data generation code that runs on the server. The version that uses the mock data has '_static' appended to the filename. So, for example, the double combo example (ch9) has two html files under the 'original' folder:
- DoubleCombo.htm points at the VB.Net back end
- DoubleCombo_static.htm points at the mock data
The htm file in the 'refactored' folder has '_refactored' appended to the title.
As a bonus, chapter 10 also has a debug version of the refactored code, that uses the debug console described in appendix A.
We'll be releasing further versions of this zip file as we add more back-end implementations, and improve the documentation. Your feedback is welcome.
Regards,
Dave Crane
Gloucestershire UK
November 2005
AJAX in Action 源代码
需积分: 0 177 浏览量
更新于2008-09-19
收藏 1.03MB RAR 举报
**AJAX(Asynchronous JavaScript and XML)是一种在无需重新加载整个网页的情况下,能够更新部分网页的技术。它通过在后台与服务器进行少量数据交换,使网页实现异步更新。这种技术可以让网页更加用户友好,提高用户体验,因为它使得网页交互更加即时且平滑。**
《AJAX in Action》这本书是Manning出版社的"In Action"系列之一,专门针对AJAX技术进行了深入的探讨和实践指导。书中涵盖了从基础到高级的AJAX开发技巧,包括XMLHttpRequest对象的使用、DOM操作、JavaScript设计模式、AJAX安全问题以及如何构建高效的AJAX应用等多个方面。
**一、XMLHttpRequest对象**
XMLHttpRequest是AJAX的核心,它允许JavaScript在后台与服务器通信。通过创建XMLHttpRequest实例,可以发送HTTP请求并处理响应。例如,发送GET或POST请求,接收服务器返回的数据,并将这些数据动态地更新到页面上。
**二、DOM操作**
Document Object Model(DOM)是HTML和XML文档的结构化表示,AJAX通过DOM来查找、修改和添加页面元素。使用JavaScript的DOM API,开发者可以方便地对页面内容进行动态更新。
**三、JavaScript设计模式**
《AJAX in Action》探讨了如何在AJAX应用中使用常见的JavaScript设计模式,如模块模式、观察者模式和工厂模式,以提高代码的可维护性和复用性。
**四、AJAX安全问题**
书中也涉及了AJAX应用的安全问题,如跨站脚本攻击(XSS)、跨站请求伪造(CSRF)和JSON劫持等,并提供了相应的防护策略。
**五、高效AJAX应用构建**
作者还分享了构建高性能AJAX应用的最佳实践,包括数据压缩、缓存策略、减少HTTP请求数量以及优化JSON序列化等方法。
**源代码分析**
"AJAX in Action 源代码"这个压缩包包含了书中所有示例的源码,读者可以通过实际运行这些代码来加深理解。源码可能包含各种类型的文件,如HTML、JavaScript、CSS以及服务器端脚本(如PHP、Java或Python),这些代码可以帮助学习者更好地掌握AJAX的实际应用。
通过这本书的源代码,开发者可以学习到如何组织和编写高效的AJAX代码,同时解决实际开发过程中遇到的问题。对于想要深入了解和提升AJAX技能的Web开发者来说,这是一个宝贵的资源。
mj37yhyy
- 粉丝: 0
- 资源: 3
最新资源
- agv 1221.fbx111
- 基于条件风险价值CVaR的微网 电厂多场景随机规划 摘要:构建了含风、光、燃、储的微网 电厂优化调度模型,在此基础上,考虑多个风光出力场景,构建了微网随机优化调度模型,并在此基础上,基于条件风险价值理
- comsol电树枝,电击穿
- Fortran语言全面教程:从基础语法到高级特性
- 运输工具检测20-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord数据集合集.rar
- PLC立体车库智能仿真 博途V15 3×2立体车库 西门子1200PLC 触摸屏仿真 不需要实物 自带人机界面 小车上下行有电梯效果 每一个程序段都有注释 FC块标准化编写 自带变频器输出也可以仿真
- 配电网有功电压控制的多智能体强化学习(代码) 针对电压主动控制问题的不同场景,采用7种最先进的MARL算法进行了大规模实验,将电压约束转化为势垒函数,并从实验结果中观察到设计合适的电压势垒函数的重要性
- COMSOL 远场偏振通用计算方法,包含远场偏振图,能带,matlab 程序 展示包含仿真文件截图,所见即所得
- 西门子V90效率倍增-伺服驱动功能库详解-简易非循环功能库之绝对值编码器校准.mp4
- 运输工具检测17-YOLO(v5至v9)、COCO、CreateML、Paligemma、TFRecord数据集合集.rar