Hi Stephen,
You might want to consider using hidden fields to accomplish this. If you run a query that returns results to fields hidden from the user, you could have a simple JavaScript that copies those values to a the appropriate parts of a table or collection. From the user's perspective, it would be a completely invisible, seamless solution.
As for running your query via JavaScript or HTML, I don't think either of those are options. The JavaScript is executed clientside, so it won't have access to the database, and HTML just doesn't have query capabilities.