title: jquery onclick hide/show div
body: <p>I have a php file that show the friends requests, lets say there are 4 requests. I want to hide the div with the class "request_buttons" when the user clicks on accept or refuse link but the problem is that it is hiding the other 3 divs too and I want to hide only the div where the link was pressed.</p>
  
  <p>My html code is:</p>
  
  <pre><code>&lt;div class="request_buttons"&gt;
     &lt;a href="#" onclick="accept(&lt;?php echo $cerere['id']; ?&gt;)"&gt;accept&lt;/a&gt;
     &lt;a href="#" onclick="refuse(&lt;?php echo $cerere['id']; ?&gt;)"&gt;refuse&lt;/a&gt;
  &lt;/div&gt;
  &lt;span class="result"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>and the javascript is: </p>
  
  <pre><code>function accept(id)
  {
      $.ajax({
         type: "POST",
         url: "request.php?action=accept",
         data: "id="+id,
         success: function(){
              $('.request_buttons').hide();
              $('.result').html('Request accepted');
         }
       });
  }
  </code></pre>
  
  <p>LE: using the code provided by Royi Namir I came up to a sollution (by mistake).
  I modified the html to this:</p>
  
  <pre><code>&lt;div id="2"&gt;    
       &lt;div class="request_buttons"&gt;
      &lt;a href="#" onclick="accept(2)"&gt;accept&lt;/a&gt;
      &lt;a href="#" onclick="refuse(2)"&gt;refuse&lt;/a&gt;
       &lt;/div&gt;
    &lt;div class="result"&gt;&lt;/div&gt;            
  &lt;/div&gt;
  </code></pre>
  
  <p>and the jquery with this:</p>
  
  <pre><code>function accept(id)
  {
  t = $('#'+id);
      $.ajax({
         type: "POST",
         url: "request.php?action=accept",
         data: "id="+id,
         success: function(){         
         $(t,'.result').first().html('Accepted');
         }
       });
  }
  </code></pre>
  
  <p>And it works, the div "request_buttons" dissapear and the message appears. I don't know how but it works!</p>