Previous Page
Next Page

7.6. Summary

One of the biggest risks in adding AJAX to an application is the increased complexity of debugging. Using the tools covered in this chapter, you can help reduce that risk. The following tools and techniques offer a solution to many of the problems you will hit when debugging AJAX:

  • Server-side logging. This logs AJAX requests and results, allowing you to debug AJAX communications without additional tools. It also allows you to collect debugging data from multiple clients.

  • Firebug. This is the Firefox extension that adds a viewer for AJAX requests and results. It also provides DOM viewing and JavaScript console improvements.

  • Fiddler. This is the debugging proxy, cross-browser way to view AJAX requests and results.

  • Script Debugger. This adds basic JavaScript debugging to IE and is the only way to find a line of JavaScript that caused the error in IE.

  • JavaScript exceptions. The use of these is the programmatic way of managing JavaScript errors, and they allow you to isolate problematic sections of JavaScript code.

  • Dumping variables. With these, you can build JavaScript functions to see the contents of an object on the fly.

The most important item to remember in the debugging processes is to test the server side and the client side separately whenever possible. When that's not an option, you'll find that looking at the data sent between the server and the browser is helpful. Most importantly, like debugging in any language, strive for a clean simple design. AJAX is already adding the complexity of client/server communications; if you add tons of complexity in your design, debugging your application will quickly become unworkable.


Previous Page
Next Page