jquery pass attrib value to form
<p>I'm muddling my way through learning jquery.  I have successfully created a form inside a modal window and can submit the data through a php post into my database.  Yay for me!</p>

<p>What I would like to do now, but am completely stuck, is have another modal window that is triggered when a user clicks an image.  When the image is clicked, I would like to have some of the post processed attribute data also passed to this window so it can be posted into a database.</p>

<p>Let me give you an example.  My webpage outputs a bunch of websites.</p>

<pre><code>Website1
Website2
Website3
</code></pre>

<p>I would like to edit this so there is an X image next to each website like this.</p>

<pre><code>Website1  X
Website2  X
Website3  X
</code></pre>

<p>When the user clicks the X, a modal window opens where they can put a comment in and click submit.  How can I capture which X they clicked?  If they click the X for Website1, put the comment in the modal box, then click submit, how do I capture "Website1" along with the comment?</p>

<p>Here is my code so far.</p>

<pre><code>    &lt;script type="text/javascript"&gt;
$(document).ready(function(){
        $(".trigger3").click(function(){
                $(".panel3").toggle("fast");
                $(this).toggleClass("active");
                return false;
        });
});
&lt;/script&gt;
</code></pre>

<p>Copy code</p>

<pre><code>&lt;script type="text/javascript"&gt;
function submitForm() {
    $.ajax({type:'POST', url: 'flagadd.php', data:$('#flagProxy').serialize(), success: function(response) {
        $('#flagProxy').find('.form_result2').html(response);
    }});

    return false;
}
&lt;/script&gt;
</code></pre>

<p>Copy code</p>

<pre><code>echo "&lt;td&gt;&lt;a class=\"trigger3\" url=\"".$url."\" href=\"#\"&gt;&lt;img src=\"images/x.png\" title=\"Flag this site for review by leaving a comment\" border=0&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;";
</code></pre>

<p>Copy code</p>

<pre><code>&lt;form id="flagProxy" onsubmit="return submitForm();"&gt;
&lt;textarea style="resize:none" name="flag" cols="25" rows="5"&gt;&lt;/textarea&gt;
&lt;br&gt;
&lt;input type="submit" name="submit" value="Submit" /&gt;
&lt;input type="button" name="cancel" value="Cancel" class="trigger3" /&gt;
&lt;div class="form_result2"&gt;&lt;/div&gt;
&lt;/form&gt;
</code></pre>
