jQuery/PHP: sliding up even if its not :last
<p>I want to slide up #FriendRequests (a bar) if its the last friend request the user is answering on (confirm/ignore).</p>

<p>When you answer confirm/ignore, it sends ajax call and on success i made this:</p>

<pre><code>$('#FriendRequests:last').slideUp('slow');
</code></pre>

<p>But my problem is now, that even if its not the last friend request you are answering on the #FriendRequests bar is sliding up.</p>

<p>How should i do this, so it slides up if its the last request the user is answering on?
 and what code/information do you need from me, please comment, so i will provide what you need in order to help me </p>

<p>Thank you</p>

<p>My code right now:</p>

<pre><code>&lt;div class="FriendRequests" style=" font-weight: bold; background: #283b43; border-bottom: 1px dashed #719dab;"&gt;
&lt;img src="images/NewFriend_small.png" style="float: left; margin-left: 25px; margin-right: 10px;"&gt;
Friend Requests
&lt;/div&gt; /* i want this to go away if its the last request the user is answering on */
    &lt;?php
        while($showW = mysql_fetch_array($friendsWaiting)){
        ?&gt;
         &lt;div id="friend&lt;?php echo $showW['id'] ?&gt;" style="position: relative; background: #3a5f6e;"&gt;
           &lt;div style="position: absolute; top: 15px; right: 105px;"&gt;
        &lt;a href='javascript:void(0);' onclick="MeYouFriendNB(true, &lt;?php echo $sid; ?&gt;, &lt;?php echo $showW["id"]; ?&gt;, &lt;?php echo $showW["bID"]; ?&gt;);" style="margin-right: 45px; color: #FFF;"&gt;CONFIRM&lt;/a&gt;
        &lt;a href="javascript:void(0);" onclick="MeYouFriendNB(false, &lt;?php echo $showW["id"]; ?&gt;, &lt;?php echo $showW["bID"]; ?&gt;, &lt;?php echo $sid; ?&gt;);" style="color: #ccc;"&gt;IGNORE&lt;/a&gt;
        &lt;/div&gt;
        &lt;?php 
        echo "&lt;div style='font-style: italic; font-size: 11px; width: 240px;
        position: absolute; top: 8px; left: 305px;'&gt;&lt;a rel='facebox' href='#friendmsg'&gt;&lt;strong&gt;\"&lt;/strong&gt;".substr($showW[msg], 0, 80) ."&lt;strong&gt;\"&lt;/strong&gt;&lt;/a&gt;
&lt;/div&gt;";
        echo "&lt;div style='display: none' id='friendmsg'&gt;$showW[msg]&lt;/div&gt;";
        echo $user['showUR']["full_name"] . "&lt;br&gt;
        &lt;span style='font-size: 12px;'&gt; ";
         showStatus($showW["bID"]); 
         showLatestSeen($showW["bID"]);
        echo "&lt;/span&gt;&lt;br&gt;&lt;div class='clearfloat'&gt;&lt;/div&gt;";
        echo "&lt;/div&gt;";
        }
        ?&gt;
</code></pre>

<p>HTML:</p>

<pre><code>&lt;div id="FriendRequests" style=" font-weight: bold; background: #283b43; border-bottom: 1px dashed #719dab;"&gt;
    &lt;img src="images/NewFriend_small.png" style="float: left; margin-left: 25px; margin-right: 10px;"&gt;
    Vänförfrågningar
&lt;/div&gt;

&lt;div id="friend99" style="position: relative; background: #3a5f6e;"&gt;
    &lt;div style="position: absolute; top: 15px; right: 105px;"&gt;
        &lt;a href='javascript:void(0);' onclick="MeYouFriendNB(true, 1, 99, 90);" style="margin-right: 45px; color: #FFF;"&gt;Bekräfta&lt;/a&gt;
        &lt;a href="javascript:void(0);" onclick="MeYouFriendNB(false, 99, 90, 1);" style="color: #ccc;"&gt;Ignorera&lt;/a&gt;
    &lt;/div&gt;
    &lt;div style='font-style: italic; font-size: 11px; width: 240px;
    position: absolute; top: 8px; left: 305px;'&gt;
        &lt;a rel='facebox' href='#friendmsg'&gt;&lt;strong&gt;"&lt;/strong&gt;&lt;strong&gt;"&lt;/strong&gt;
        &lt;/a&gt;
    &lt;/div&gt;
    &lt;div style='display: none' id='friendmsg'&gt;&lt;/div&gt;
    &lt;div style='margin-top: 5px; margin-left: 45px; margin-bottom: 5px; '&gt;
        &lt;span style='float: left; border: 1px dashed #CCC; margin-right: 5px;'&gt;
            &lt;img src='images/profileimages/noPhoto_thumb.jpg'&gt;
        &lt;/span&gt;
        Mads Kluge &lt;br&gt;
        &lt;span style='font-size: 12px;'&gt; 25-08-2010 kl. 20:31&lt;/span&gt;
        &lt;br&gt;
        &lt;div class='clearfloat'&gt;&lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt; 

&lt;div id="friend100" style="position: relative; background: #3a5f6e;"&gt;
    &lt;div style="position: absolute; top: 15px; right: 105px;"&gt;
        &lt;a href='javascript:void(0);' onclick="MeYouFriendNB(true, 1, 100, 3);" style="margin-right: 45px; color: #FFF;"&gt;Bekräfta&lt;/a&gt;
        &lt;a href="javascript:void(0);" onclick="MeYouFriendNB(false, 100, 3, 1);" style="color: #ccc;"&gt;Ignorera&lt;/a&gt;
    &lt;/div&gt;
    &lt;div style='font-style: italic; font-size: 11px; width: 240px;
    position: absolute; top: 8px; left: 305px;'&gt;
        &lt;a rel='facebox' href='#friendmsg'&gt;&lt;strong&gt;"&lt;/strong&gt;&lt;strong&gt;"&lt;/strong&gt;&lt;/a&gt;
    &lt;/div&gt;
    &lt;div style='display: none' id='friendmsg'&gt;&lt;/div&gt;
    &lt;div style='margin-top: 5px; margin-left: 45px; margin-bottom: 5px; '&gt;
        &lt;span style='float: left; border: 1px dashed #CCC; margin-right: 5px;'&gt;
            &lt;img src='images/profileimages/noPhoto_thumb.jpg'&gt;
        &lt;/span&gt;
        Ani Paltian &lt;br&gt;
        &lt;span style='font-size: 12px;'&gt; 17-08-2010 kl. 18:19&lt;/span&gt;
        &lt;br&gt;
        &lt;div class='clearfloat'&gt;&lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;​

function MeYouFriendNB(confirm, uID, fID, bID){
 var c = confirm ? 'confirm' : 'ignore';
    $.ajax({ 
       type: "POST",
       url: "misc/AddFriend.php",
    data: {
    mode: 'ajax',
            friend: c,
            uID: uID,
            fID: fID,
            bID: bID
            },
       success: function(msg){
            $('#friend'+fID).slideUp('slow');
        }
     });
}
</code></pre>
