Ajax Hacks, by Bruce W. Perry
Last week, I reviewed Head Rush Ajax (Brett McLaughlin, O'Reilly Media), and it was really my first taste of AJAX. That book gave me a good grounding to move forward, but I hadn't been able to dedicate time to really experimenting with it in my own context - which, of course, is really the whole point. Instead, I ended up going through the Drupal (the content management system that runs this site, and a few client sites) documentation and new code release looking at whether AJAX could be of use in some scenarios.
Well, there's already some AJAX implemented in the new Drupal, and where I would like to implement AJAX (for comments and perhaps, in future, trackbacks) is something I am still picking apart to do what I think needs to be done. It's a pet project, actually.
Ajax Hacks : Tips & Tools for Creating Responsive Web Sites showed up while I was doing all of this, and ended up being pretty helpful in both understanding how the present release candidate for Drupal 4.7 uses AJAX and how I might go about doing some things. After all, I'm a novice approaching intermediate level experience when it comes to AJAX - mainly thanks to these books.
The Book
![]() |
I should probably start off with the fact that there are 80 AJAX hacks1 in this book, and given my own experience, I was looking for a platform to see how other people were doing things, and how I might want to do some of the things I wanted to. The first chapter, on Ajax basics, gave me some more examples that carried over from Head Rush Ajax Chapter 2, with it's 10 hacks on Web Forms, got a lot of attention from me. I experimented a lot with these hacks, using my own server sandbox to do the experimentation. These hacks were really handy, and I expect that they will continue to be since a lot of what I want to do - and what Ajax allows for - is related to avoiding reloading pages that really don't need to be reloaded. Forms in a flesh and blood user-centric universe are a big part of this, and gave me some more tools to work with - as well as allowed me to come up with new and interesting ways to do things. Over the next few weeks, I expect to implement some of these ideas in this site and a few client sites. And that all leads to Chapter 3, 'Validation', which is basically about not letting users shoot you in the foot with your own website. Chapter 4, with it's Power Hacks for Web Developers, had me really having fun in the sandbox - so much so that I was playing with that particular section a lot this weekend because, in it's own way, it's fun and educational. And this book just keeps going on with examples... and having read the whole book at this point, and doing most of the examples, I feel I can call myself an intermediate developer... but I also know that I have a long way to go before I am expert enough to write a book on it. In all, as a geek, this book brought back to me the joy of the original Compute! and the Byte magazines of the 1980s. There were examples, but they were open ended enough to allow me to put some 'me' in the code so that I could 'own' what I did. And that, when it comes to programming, is important. |
Overall
Sure, I read the book and I'm reviewing it - but in reviewing it I do not feel I am doing it justice because it's full of all sorts of things that I just haven't put into my own context yet. As far as web development books go, there are some that you read and give away - and there are those that you keep, and put a GPS tracker on so you can find it under the old pizza boxes when you need it.
This book is the latter. It's one of the few books that is sitting next to the monitor on the desk, within reach. A true web developer knows what that means. If you're new to Ajax, or even intermediate, this book is as useful as you allow it to be. This book, however, is not for people new to web development. Some javascript knowledge is necessary, as well as concepts of web development that you won't get from the Microsoft Frontpage help menu. Of course, I don't have Microsoft Frontpage, so feel free to correct me if I'm wrong on that. Real web developers don't use Frontpage. And real database folks don't use Microsoft Access either, while I'm at it.
Without the index, the book weighs in at 403 pages and they are not wasted. This is a book for programmers, written by someone who speaks 'programese' or 'developese' fluently; hats off to Bruce W. Perry for writing a reference book that is readable. With only a week under my belt, at no time was I 'lost' with this book. I needed to fill in gaps of knowledge, and these were easy enough to fill - in fact, reading the book allowed me to find the gaps more quickly.
The only problem I had with the book was the classic programming book binding problem: The introductory level stuff is in the front of the book, and doesn't lay open well. However, the binding O'Reilly did allows for the 'press into place with brute force' to work without weakening the book as in classic binding, so they thought of it.
On a scale of 1 to 10 for usefulness, I rate this book a 7. 10, of course, is if Bruce W. Perry comes to my office and does my work for me, and I'm betting he would charge me more than $20 to do that. So, as far as I'm concerned, 7 is as high as you can get from a book without getting the author involved in doing your work for you. And if you want someone to do your work for you, contract me or someone else who has a worn copy of this book on their desk. :-)
(Also see the O'Reilly catalog)
1: Here's a listing of what is in the book; I don't usually do this but because of the nature of the book, it's important:
Chapter 1. Ajax Basics
Hack 1. Detect Browser Compatibility with the Request Object
Hack 2. Use the Request Object to POST Data to the Server
Hack 3. Use Your Own Library for XMLHttpRequest
Hack 4. Receive Data as XML
Hack 5. Get Plain Old Strings
Hack 6. Receive Data as a Number
Hack 7. Receive Data in JSON Format
Hack 8. Handle Request Object Errors
Hack 9. Dig into the HTTP Response
Hack 10. Generate a Styled Message with a CSS File
Hack 11. Generate a Styled User Message on the Fly
Chapter 2. Web Forms
Hack 12. Submit Text Field or textarea Values to the Server Without a Browser Refresh
Hack 13. Display Text Field or textarea Values Using Server Data
Hack 14. Submit Selection-List Values to the Server Without a Round Trip
Hack 15. Dynamically Generate a New Selection List Using Server Data
Hack 16. Extend an Existing Selection List
Hack 17. Submit Checkbox Values to the Server Without a Round Trip
Hack 18. Dynamically Generate a New Checkbox Group with Server Data
Hack 19. Populate an Existing Checkbox Group from the Server
Hack 20. Change Unordered Lists Using an HTTP Response
Hack 21. Submit Hidden Tag Values to a Server Component
Chapter 3. Validation
Hack 22. Validate a Text Field or textarea for Blank Fields
Hack 23. Validate Email Syntax
Hack 24. Validate Unique Usernames
Hack 25. Validate Credit Card Numbers
Hack 26. Validate Credit Card Security Codes
Hack 27. Validate a Postal Code
Chapter 4. Power Hacks for Web Developers
Hack 28. Get Access to the Google Maps API
Hack 29. Use the Google Maps API Request Object
Hack 30. Use Ajax with a Google Maps and Yahoo! Maps Mash-up
Hack 31. Display a Weather.com XML Data Feed
Hack 32. Use Ajax with a Yahoo! Maps and GeoURL Mash-up
Hack 33. Debug Ajax-Generated Tags in Firefox
Hack 34. Fetch a Postal Code
Hack 35. Create Large, Maintainable Bookmarklets
Hack 36. Use Permanent Client-Side Storage for Ajax Applications
Hack 37. Control Browser History with iframes
Hack 38. Send Cookie Values to a Server Program
Hack 39. Use XMLHttpRequest to Scrape an Energy Price from a Web Page
Hack 40. Send an Email with XMLHttpRequest
Hack 41. Find the Browser's Locale Information
Hack 42. Create an RSS Feed Reader
Chapter 5. Direct Web Remoting (DWR)for Java Jocks
Hack 43. Integrate DWR into Your Java Web Application
Hack 44. Use DWR to Populate a Selection List from a Java Array
Hack 45. Use DWR to Create a Selection List from a Java Map
Hack 46. Display the Keys/Values from a Java HashMap on a Web Page
Hack 47. Use DWR to Populate an Ordered List from a Java Array
Hack 48. Access a Custom Java Object with JavaScript
Hack 49. Call a Built-in Java Object from JavaScript Using DWR
Chapter 6. Hack Ajax with the Prototype and Rico Libraries
Hack 50. Use Prototype's Ajax Tools with Your Application
Hack 51. Update an HTML Element's Content from the Server
Hack 52. Create Observers for Web Page Fields
Hack 53. Use Rico to Update Several Elements with One Ajax Response
Hack 54. Create a Drag-and-Drop Bookstore
Chapter 7. Work with Ajax and Ruby on Rails
Hack 55. Install Ruby on Rails
Hack 56. Monitor Remote Calls with Rails
Hack 57. Make Your JavaScript Available to Rails Applications
Hack 58. Dynamically Generate a Selection List in a Rails Template
Hack 59. Find Out Whether Ajax Is Calling in the Request
Hack 60. Dynamically Generate a Selection List Using Database Data
Hack 61. Periodically Make a Remote Call
Hack 62. Dynamically View Request Information for XMLHttpRequest
Chapter 8. Savor the script.aculo.us JavaScript Library
Hack 63. Integrate script.aculo.us Visual Effects with an Ajax Application
Hack 64. Create a Login Box That Shrugs Off Invalid Logins
Hack 65. Create an Auto-Complete Field with script.aculo.us
Hack 66. Create an In-Place Editor Field
Hack 67. Create a Web Form That Disappears When Submitted
Chapter 9. Options and Efficiencies
Hack 68. Fix the Browser Back Button in Ajax Applications
Hack 69. Handle Bookmarks and Back Buttons with RSH
Hack 70. Set a Time Limit for the HTTP Request
Hack 71. Improve Maintainability, Performance, and Reliability for Large JavaScript Applications
Hack 72. Obfuscate JavaScript and Ajax Code
Hack 73. Use a Dynamic script Tag to Make Web Services Requests
Hack 74. Configure Apache to Deal with Cross-Domain Issues
Hack 75. Run a Search Engine Inside Your Browser
Hack 76. Use Declarative Markup Instead of Script via XForms
Hack 77. Build a Client-Side Cache
Hack 78. Create an Auto-Complete Field
Hack 79. Dynamically Display More Information About a Topic
Hack 80. Use Strings and Arrays to Dynamically Generate HTML
Index


Post new comment