Javascript - how do I minimise this code example?
<p>a quick question. </p>

<p>At the moment I have 12 links on a page, and 12 corresponding javascript codes that run when a each button is clicked.</p>

<p>I know 100% there must be a method of having 1 javascript code and the link passing a variable  to it, so I don't have to have 12 different codes. </p>

<p>EG. Here is a link I'm currently using:</p>

<pre><code>&lt;a href="#" id="button1"&gt;Anatomical Pathology&lt;/a&gt;
</code></pre>

<p>And the Javascript function that is run when the link is clicked loads some html from a php script into a div which is previously defined as level2:</p>

<pre><code>$('#button1').click(function() {
    level2.load("http://hello/script.php?url=poodles");
}); 
</code></pre>

<p>What I'd really like to do is something like this with the link:</p>

<pre><code>&lt;a href="#" id="button1" passurl="poodles"&gt;Anatomical Pathology&lt;/a&gt;
</code></pre>

<p>And the function something like this, so I only need the 1 function not 12:</p>

<pre><code>$('#button1').click(function() {
    level2.load("http://hello/script.php?url=' + passurl + '");
}); 
</code></pre>

<p>How do I go about getting the data from the link tag into javascript, and also how do I add this passed variable into the url I want the javascript to pull data in from?</p>
