You should definitely have a look at the eZJSCore extension, now shipped with any eZ Publish build, designed to ease usage of Javascript and Ajax within eZ Publish. A tutorial worth reading : http://share.ez.no/learn/ez-publish/ezjscore-ez-publish-javascript-and-ajax-framework
Cheers,
--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board