Row data from outside loop

Hello

I have a while loop that displays my blog posts.

{
echo $row['blog-title'];
echo $row['author'];
}

I am trying to implement a peice of javascript where whenever a user clicks on the blog post, it displays an alert containing the post.
I could easily add the js code inline into the while loop like this

alert("<? echo $row['blog']; ?>");

However due to technical reasons, I have to add the js code in a separate file outside the loop.
My question is how can I retrieve the blog data outside of the loop, and attach it to each result?

For example, now the element is like this:
<div class=“posts”>
<h2 class=“title”></h2>
<h3 class=“author”></h3>
<p class=“content”>blahblahblah</p>
</div>

In, JQuery we can do this:
$(“.title”).click(function(){
alert($(this).siblings(“.content”).html());
});

Where “.title” refers to which element shall click event attached to and .html() return the blog post contained.
I’m not sure if this help to solved your problem. I don’t really understand what you mean by “clicks on the blog post”.