Chapter 1: AJAX and Rich Internet Applications
追求效率的我决定直接跳过这一章。
Chapter 2: AJAX Building Blocks
JavaScript:
文档对象模型(DOM):
级联样式表(CSS):
XMLHttpRequest (XHR):
这里介绍的内容和上一本书的后面章节Client-Server Communication没有太多差别,除了介绍XMLHTTPRequest基本的操作,也提供一个方案,将它封装在一个对象里,可以跨浏览器使用,后面介绍了使用XML与JSON,后面这个是前面那本书没有提到的。所以现在看看JSON:
首先这本书在这节用的图是错的,真是不靠谱,错的太严重。Javascript收到JSON后,解析的方法很简单,就是传给eval()函数,返回的就是一个Javascript里的对象了。
var Customer = eval('({
"firstName": "John",
"lastName": "Doe",
"address": {
"street": "555 Sunnyside Drive",
"city": "Vancouver"
}
})');
alert(Customer.firstName + ' ' + Customer.lastName);
Notice:
Finally, after reading the first 3 chapters, I decided to abandon reading this book, because its focus is on 'Enterprise Level Design & Implementation', and that is not beginners' common concerns.