jQuery/PHP: sliding up even if its not :last

mucski

New Member
I want to slide up #FriendRequests (a bar) if its the last friend request the user is answering on (confirm/ignore).When you answer confirm/ignore, it sends ajax call and on success i made this:\[code\]$('#FriendRequests:last').slideUp('slow');\[/code\]But my problem is now, that even if its not the last friend request you are answering on the #FriendRequests bar is sliding up.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 Thank youMy code right now:\[code\]<div class="FriendRequests" style=" font-weight: bold; background: #283b43; border-bottom: 1px dashed #719dab;"><img src="http://stackoverflow.com/questions/3591185/images/NewFriend_small.png" style="float: left; margin-left: 25px; margin-right: 10px;">Friend Requests</div> /* i want this to go away if its the last request the user is answering on */ <?php while($showW = mysql_fetch_array($friendsWaiting)){ ?> <div id="friend<?php echo $showW['id'] ?>" style="position: relative; background: #3a5f6e;"> <div style="position: absolute; top: 15px; right: 105px;"> <a href='javascript:void(0);' onclick="MeYouFriendNB(true, <?php echo $sid; ?>, <?php echo $showW["id"]; ?>, <?php echo $showW["bID"]; ?>);" style="margin-right: 45px; color: #FFF;">CONFIRM</a> <a href="javascript:void(0);" onclick="MeYouFriendNB(false, <?php echo $showW["id"]; ?>, <?php echo $showW["bID"]; ?>, <?php echo $sid; ?>);" style="color: #ccc;">IGNORE</a> </div> <?php echo "<div style='font-style: italic; font-size: 11px; width: 240px; position: absolute; top: 8px; left: 305px;'><a rel='facebox' href='http://stackoverflow.com/questions/3591185/#friendmsg'><strong>\"</strong>".substr($showW[msg], 0, 80) ."<strong>\"</strong></a></div>"; echo "<div style='display: none' id='friendmsg'>$showW[msg]</div>"; echo $user['showUR']["full_name"] . "<br> <span style='font-size: 12px;'> "; showStatus($showW["bID"]); showLatestSeen($showW["bID"]); echo "</span><br><div class='clearfloat'></div>"; echo "</div>"; } ?>\[/code\]HTML:\[code\]<div id="FriendRequests" style=" font-weight: bold; background: #283b43; border-bottom: 1px dashed #719dab;"> <img src="http://stackoverflow.com/questions/3591185/images/NewFriend_small.png" style="float: left; margin-left: 25px; margin-right: 10px;"> V?nf?rfr?gningar</div><div id="friend99" style="position: relative; background: #3a5f6e;"> <div style="position: absolute; top: 15px; right: 105px;"> <a href='javascript:void(0);' onclick="MeYouFriendNB(true, 1, 99, 90);" style="margin-right: 45px; color: #FFF;">Bekr?fta</a> <a href="javascript:void(0);" onclick="MeYouFriendNB(false, 99, 90, 1);" style="color: #ccc;">Ignorera</a> </div> <div style='font-style: italic; font-size: 11px; width: 240px; position: absolute; top: 8px; left: 305px;'> <a rel='facebox' href='http://stackoverflow.com/questions/3591185/#friendmsg'><strong>"</strong><strong>"</strong> </a> </div> <div style='display: none' id='friendmsg'></div> <div style='margin-top: 5px; margin-left: 45px; margin-bottom: 5px; '> <span style='float: left; border: 1px dashed #CCC; margin-right: 5px;'> <img src='http://stackoverflow.com/questions/3591185/images/profileimages/noPhoto_thumb.jpg'> </span> Mads Kluge <br> <span style='font-size: 12px;'> 25-08-2010 kl. 20:31</span> <br> <div class='clearfloat'></div> </div></div> <div id="friend100" style="position: relative; background: #3a5f6e;"> <div style="position: absolute; top: 15px; right: 105px;"> <a href='javascript:void(0);' onclick="MeYouFriendNB(true, 1, 100, 3);" style="margin-right: 45px; color: #FFF;">Bekr?fta</a> <a href="javascript:void(0);" onclick="MeYouFriendNB(false, 100, 3, 1);" style="color: #ccc;">Ignorera</a> </div> <div style='font-style: italic; font-size: 11px; width: 240px; position: absolute; top: 8px; left: 305px;'> <a rel='facebox' href='http://stackoverflow.com/questions/3591185/#friendmsg'><strong>"</strong><strong>"</strong></a> </div> <div style='display: none' id='friendmsg'></div> <div style='margin-top: 5px; margin-left: 45px; margin-bottom: 5px; '> <span style='float: left; border: 1px dashed #CCC; margin-right: 5px;'> <img src='http://stackoverflow.com/questions/3591185/images/profileimages/noPhoto_thumb.jpg'> </span> Ani Paltian <br> <span style='font-size: 12px;'> 17-08-2010 kl. 18:19</span> <br> <div class='clearfloat'></div> </div></div>?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\]
 
Back
Top