1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-05 16:04:24 +03:00
ifhub.club/templates/skin/developer-jquery/js/friend.js

43 lines
1.5 KiB
JavaScript
Raw Normal View History

2011-04-01 10:49:36 +03:00
function ajaxAddUserFriend(obj, idUser, sAction) {
if(sAction != 'link' && sAction != 'accept') {
sText = $('#add_friend_text').val();
$('#add_friend_form').children().each(function(i, item){$(item).attr('disabled','disabled')});
} else {
sText='';
}
if(sAction == 'accept') {
sPath = aRouter.profile+'ajaxfriendaccept/';
} else {
sPath = aRouter.profile+'ajaxfriendadd/';
}
$.post(sPath, { idUser: idUser, userText: sText, security_ls_key: LIVESTREET_SECURITY_KEY }, function(result){
if (!result) {
$.notifier.error('Error','Please try again later');
$('#add_friend_form').children().each(function(i, item){$(item).removeAttr('disabled')});
}
if (result.bStateError) {
$.notifier.error(null,result.sMsg);
$('#add_friend_form').children().each(function(i, item){$(item).removeAttr('disabled')});
} else {
$.notifier.notice(null,result.sMsg);
$('#add_friend_form').jqmHide();
$('#add_friend_item').remove();
$('#profile_actions').prepend($(result.sToggleText));
}
});
}
function ajaxDeleteUserFriend(obj,idUser,sAction) {
$.post(aRouter.profile+'ajaxfrienddelete/', { idUser: idUser,sAction: sAction, security_ls_key: LIVESTREET_SECURITY_KEY }, function(result) {
if (result.bStateError) {
$.notifier.error(null,result.sMsg);
} else {
$.notifier.notice(null,result.sMsg);
$('#delete_friend_item').remove();
$('#profile_actions').prepend($(result.sToggleText));
}
});
}