I rarely write my own Ajax code anymore (unless I'm doing something fairly complex), and the script evaluation feature that Eric mentions will save you the time and effort of isolating the script from the HTML and eval-ing it on your own.