没有合适的资源?快使用搜索试试~ 我知道了~
首页head_first_ajax.pdf
资源详情
资源评论
资源推荐


Table of Contents
Chapter 1. using ajax.................................................................................... 1
Section 1.1. Web pages: the old-fashioned approach..................................................................................................................... 2
Section 1.2. Web pages reinvented................................................................................................................................................. 3
Section 1.3. So what makes a page "Ajax"?..................................................................................................................................... 5
Section 1.4. Rob's Rock 'n' Roll Memorabilia................................................................................................................................. 6
Section 1.5. Ajax and rock 'n' roll in 5 steps.................................................................................................................................. 12
Section 1.6. Step 1: Modify the XHTML........................................................................................................................................ 14
Section 1.7. Step 2: Initialize the JavaScript................................................................................................................................. 16
Section 1.8. Step 3: Create a request object.................................................................................................................................. 20
Section 1.9. Step 4: Get the item's details..................................................................................................................................... 22
Section 1.10. Let's write the code for requesting an item's details............................................................................................... 24
Section 1.11. Always make sure you have a request object before working with it...................................................................... 25
Section 1.12. The request object is just an object......................................................................................................................... 26
Section 1.13. Hey, server... will you call me back at displayDetails(), please?............................................................................. 27
Section 1.14. Use send() to send your request.............................................................................................................................. 28
Section 1.15. The server usually returns data to Ajax requests.................................................................................................... 30
Section 1.16. Ajax is server-agnostic.............................................................................................................................................. 31
Section 1.17. Use a callback function to work with data the server returns................................................................................. 35
Section 1.18. Get the server's response from the request object's responseText property.......................................................... 36
Section 1.19. Goodbye traditional web apps................................................................................................................................. 38
Section 1.20. AjaxAcrostic............................................................................................................................................................. 39
Chapter 1. using ajax
Chapter 1. using ajax
Head First Ajax By Rebecca M. Riordan ISBN: 9780596515782 Publisher: O'Reilly Prepared for Ann Cherkis, Safari ID: maottw@gmail.com
Print Publication Date: 2008/08/26 User number: 1673621 Copyright 2008, Safari Books Online, LLC.
This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior
written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that
otherwise violates the Safari Terms of Service is strictly prohibited.

this is a new chapter 1
using ajax
1
Web Apps for a New
Generation
Tired of waiting around for your page to reload?
)UXVWUDWHGE\FOXQN\ZHEDSSOLFDWLRQLQWHUIDFHV",W¶VWLPHWRJLYH\RXUZHEDSSVWKDW
VOLFNUHVSRQVLYHGHVNWRSIHHO$QGKRZGR\RXGRWKDW":LWKAjax\RXUWLFNHWWR
EXLOGLQJ,QWHUQHWDSSOLFDWLRQVWKDWDUHmore interactive, more responsive, DQGeasier
to use6RVNLS\RXUQDSLW¶VWLPHWRSXWVRPHSROLVKRQ\RXUZHEDSSV,W¶VWLPHWR
JHWULGRIXQQHFHVVDU\DQGVORZIXOOSDJHUHIUHVKHVIRUHYHU
,·OOMXVWWDNHDOLWWOHQDS
ZKLOH,·PZDLWLQJIRUP\
ZHEDSSWRUHVSRQG
Chapter 1. using ajax Page 1 Return to Table of Contents
Chapter 1. using ajax
Head First Ajax By Rebecca M. Riordan ISBN: 9780596515782 Publisher: O'Reilly Prepared for Ann Cherkis, Safari ID: maottw@gmail.com
Print Publication Date: 2008/08/26 User number: 1673621 Copyright 2008, Safari Books Online, LLC.
This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior
written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that
otherwise violates the Safari Terms of Service is strictly prohibited.

2
Chapter 1
Web pages: the old-fashioned approach
With traditional web pages and applications, every time a user clicks on
something, the browser sends a request to the server, and the server responds
with a whole new page. Even if your user’s web browser is smart about
caching things like images and cascading style sheets, that’s a lot of traffic
going back and forth between their browser and your server... and a lot of
time that the user sits around waiting for full page refreshes.
The user clicks
something on
your page.
The browser
sends a request
to the server.
The server sends back
a whole new page,
with all the changed
information.
The user clicks
something else.
The browser sends
another request to
the server.
And the server
sends back another
whole page...
Most of the time, only a single line or image is
changing... but there’s still a complete page refresh.
old-fashioned web apps
Chapter 1. using ajax Page 2 Return to Table of Contents
Chapter 1. using ajax
Head First Ajax By Rebecca M. Riordan ISBN: 9780596515782 Publisher: O'Reilly Prepared for Ann Cherkis, Safari ID: maottw@gmail.com
Print Publication Date: 2008/08/26 User number: 1673621 Copyright 2008, Safari Books Online, LLC.
This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior
written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that
otherwise violates the Safari Terms of Service is strictly prohibited.

you are here 3
using ajax
Web pages reinvented
This time, your page’s code creates
a special request object that the
browser sends to the server.
The server updates
the request object...
...and your code tells the
browser to update only the
parts of the page that
have changed.
Using Ajax, your pages and applications only ask the server for what they
really need—just the parts of a page that need to change, and just the parts
that the server has to provide. That means less traffic, smaller updates, and
less time sitting around waiting for page refreshes.
With Ajax, the browser only sends and receives
the parts of a page that need to change.
The user clicks
something.
Sometimes the browser doesn’t have to
talk to the server at all.
The browser calls
a function in
your script file.
The script tells the browser
how to update the page... all
without a page refresh.
The script can update the
image without the server-side
program at all!
request
request
With Ajax, the user doesn’t
have to suffer page flickers
or lots of waiting around...
they can even keep using the
page while the request is
being processed.
function
getDetails {
...
}
function
getDetails {
...
}
Chapter 1. using ajax Page 3 Return to Table of Contents
Chapter 1. using ajax
Head First Ajax By Rebecca M. Riordan ISBN: 9780596515782 Publisher: O'Reilly Prepared for Ann Cherkis, Safari ID: maottw@gmail.com
Print Publication Date: 2008/08/26 User number: 1673621 Copyright 2008, Safari Books Online, LLC.
This PDF is exclusively for your use in accordance with the Safari Terms of Service. No part of it may be reproduced or transmitted in any form by any means without the prior
written permission for reprints and excerpts from the publisher. Redistribution or other use that violates the fair use priviledge under U.S. copyright laws (see 17 USC107) or that
otherwise violates the Safari Terms of Service is strictly prohibited.
剩余477页未读,继续阅读

















myrainblues
- 粉丝: 85
- 资源: 21
上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

会员权益专享
最新资源
- ARM Cortex-A(armV7)编程手册V4.0.pdf
- ABB机器人保养总结解析.ppt
- 【超详细图解】菜鸡如何理解双向链表的python代码实现
- 常用网络命令的使用 ipconfig ping ARP FTP Netstat Route Tftp Tracert Telnet nslookup
- 基于单片机控制的DC-DC变换电路
- RS-232接口电路的ESD保护.pdf
- linux下用time(NULL)函数和localtime()获取当前时间的方法
- Openstack用户使用手册.docx
- KUKA KR 30 hA,KR 60 hA机器人产品手册.pdf
- Java programming with JNI
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制

评论2