function
Add(e) {
var
friend_id = e.id;
var
name = $(
"#"
+ friend_id).html();
var
content =
"<p id=\"friend"
+ friend_id +
"\" class=\"case-item\" onclick=\""
+ game_type +
"(this)\"><p class=\"ih-item circle effect1\"><a href=\"#\"><img class=\"img_wrong\" src=\"image/wrong.png\" style=\"float: right; width: 15px; height: 15px;display:none\" /><p class=\"spinner\"></p><p class=\"img\"><h3 id=\""
+ friend_id +
"\">"
+ name +
"</h3></p><p class=\"info\"><p class=\"info-back\"><h3 class=\"info-word\">"
+ info_word +
"</h3></p></p></a></p></p>"
;
$.ajax({
url:
"userlist.aspx/AddFriend"
,
data:
"{'username':'"
+ $('#username
').text() + "'
,
'friend_id'
:
'" + friend_id + "'
}",
type:
'Post'
,
contentType:
"application/json; charset=utf-8"
,
dataType:
"json"
,
success:
function
(result) {
if
(result.d ==
"true"
) {
$(
".case-content"
).append(content);
}
else
{
alert(result.d);
}
},
error:
function
(err) {
alert(
"未知错误"
);
}
});
}
function
Delete
(e) {
var
friend_id = e.id;
$.ajax({
url:
"userlist.aspx/DeleteFriend"
,
data:
"{'username':'"
+ $('#username
').text() + "'
,
'friend_id'
:
'" + friend_id + "'
}",
type:
'Post'
,
contentType:
"application/json; charset=utf-8"
,
dataType:
"json"
,
success:
function
(result) {
if
(result.d == true) {
$(
"#"
+ friend_id).remove();
}
if
(result.d == false) { alert(
"删除失败"
); }
},
error:
function
(err) {
alert(
"未知错误"
);
}
});
}
function
ChangeToDelete() {
$(
".case-item"
).removeAttr(
"onclick"
);
$(
".case-item"
).attr(
"onclick"
,
"Delete(this);"
);
$(
".img_wrong"
).css(
"display"
,
"block"
);
$(
".info-word"
).html(
"删除"
);
}
function
ChangeToNormal() {
$(
".case-item"
).removeAttr(
"onclick"
);
$(
".case-item"
).attr(
"onclick"
,
""
);
$(
".img_wrong"
).css(
"display"
,
"none"
);
$(
".info-word"
).html(info_back);
}