The easiest solution would be to build the balloon data into the KML
you're already loading to define the placemarks. If you're building
the placemarks manually in javascript, you'll probably want to look
into generating the KML on the server and using fetchKML to grab it.
With that you can control whatever you want in the balloons.
Alternatively, you could use eventHandling to detect when the user
clicks on a placemark, then use javascript to send an AJAX request to
the server for the needed information and create the balloon from
there. This would be less bandwidth intensive if you have tons and
tons of data, but the first method will be easier, less error prone,
and snappier to respond to the user's clicks.