New to jQuery
New to jQuery
I have searched everywhere on google and can't find exactly what I need so I hopefully someone can help me here.
I have a list of friends listed for a user on his profile page and I want the ability for him/her to delete a friend if they would like by clicking an 'X' image so I have two functions in php. One that pulls out the firends and echos them in a table and the other that deletes a given friend.
Here is the jquery and html I am using:
-
'<script type="text/javascript">
function osmajax(thediv, subaction, user, mem)
{
$.ajax({
type: "POST",
url: "'.$scripturl.'?action=chat",
data: "sa=+subaction+&u=+user+&m=+mem+&ajax=1",
success: function(resp){
$(#+thediv+).html(resp);
}
});
}
</script>';
Which is in the head section. And the html where the image is:
-
<div id="friends">
<table>
foreach ($friends as $key => $value)
{
echo '<tr>
<td align="left" style="padding: 2px 0px 2px 7px;"><a href="'.$scripturl.'?action=profile;u='.$key.'">'.$value['name'].'</a></td>
<td align="center" style="padding:2px;">'.$value['status'].'</td>
<td align="center" style="padding:2px"><a href="#" onclick="osmajax(\'friends\', \'deletefriends\', \''.$key.'\', \''.$context['user']['id'].'\');"><img src="'.$settings['images_url'].'/icons/quick_remove.gif" border="0" alt="'.$txt['chat_delete'].'"></a></td>
</tr>';
}
</table>
</div>
I am using SMF in case you were wondering about the variables. But I can't get it to work. Any help would be great