Depending on what your needs are, there are also 2 items that can help.
The Webpart to API converter can allow you to run a webpart (which has access to server side code) that can return something like JSON or HTML and present it. I've done similar to your situation by creating a page with a repeater that renders the display HTML code, then use the Webpart to API converter to convert it to a feed so in javascript i can call it, get the details (passing a url parameter), and then just insert the returning content into the details display div or what not.
Also Eric's Ajax Helper can help you if you put your custom code in a Macro method.