How to select the correct id for the specific button pressed in dynamic table 2 PHP JQUERY
<p>I have a very similar problem, but i cant seem to figure it out, it could be that i have been trying to do this for the past 14 hours... 
my problem is: I cant get this to return the corresponding customer id, it just always returns the first one.
here is the code</p>

<pre><code>&lt;div id="saveAdButtons"&gt;
&lt;?php

if ($limit == 5){ 
for ($i=0;$i&lt;$count;++$i){


$results33 = mysql_query("SELECT * FROM  saved_ads WHERE customer_id='{$contact_id}'") or die(mysql_error());
$data2222 = mysql_fetch_array($results33);
$idCheck = $data2222['customer_id'];
   if($ids[$i]!=$idCheck){?&gt;
&lt;button  name="contact_ids[]" class="contact_ids" id="contact_ids0" title="Save Ad: &lt;?php echo $ids[$i]?&gt;" value="Save Ad" &gt;&lt;/button&gt;

&lt;input name="parse" id="SaveBtnID" type="hidden" value="&lt;?php echo $ids[$i] ?&gt;" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;?php 
    } } }?&gt;
</code></pre>

<p>Here is JQUERY code</p>

<pre><code>$(document).ready(function(){
$( "#contact_ids0" ).live('click',function(event){
</code></pre>

<p>what should I put here??..
i have tried </p>

<pre><code>    var tr = $(this).closest('I DONT KNOW WHAT TO PUT HERE');   // 
    tr.find('#I DONT KNOW WHAT TO PUT HERE').empty(); // 
  var vidid = tr.find('#SaveBtnID').val(); 
</code></pre>

<p>but it returns the first id only, no matter which button i click :(</p>

<pre><code>var datastr2="ids="+CusID;
         alert(CusID);
return true;
    });
});
</code></pre>

<p>thank you in advance! :)</p>
