I could write an entire book, or at
least a full chapter, on the subject, but you??™ll fi nd this short list of the best tools
and techniques helpful:
1 A JavaScript console: Firefox has a JavaScript console built in.
It??™ll print errors and other necessary messages to aid your debugging.
If an Ajax page doesn??™t work as expected, this is the fi rst place
you should look.
142 Appendix
alert(???Inside the handleResponse() function.??™);
alert(ajax.responseText);
2 JavaScript alerts: I recommend using alerts to confi rm what
functions are executed and what the values of variables are.
Appendix 143
debugging JavaScript (cont.)
3 A DOM inspector: Because most Ajax applications change a page??™s content
dynamically, just looking at the source of the page won??™t be of use. Instead, use
a DOM inspector to see the modifi ed page content. Firefox has one built in (on
Windows, you??™ll need to do a custom install of Firefox to add the inspector).
You can also fi nd and install DOM inspectors that work with Internet Explorer
and Safari, but why bother when Firefox??™s already exists?
144 Appendix
4 The Venkman JavaScript Debugger
(www.
Pages:
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123