如何将好友表中的状态从待处理更新为已接受?
经过大量谷歌搜索后,我成功发送了添加为好友的请求,假设用户 a 向用户 b 发送了好友请求,并且用户 b 登录,他将看到来自用户 a 的请求...假设当用户时仅显示他的名字单击该名称,将打开一个对话框,询问用户是否接受或拒绝该请求,我现在面临的问题是我无法找到如何将朋友表状态列从待处理更新为已接受即当显示好友请求已接受的提醒消息时朋友表的状态列应从待处理更新为已接受,如果被拒绝,则应将状态列更新为被拒绝,
请指导我完成此操作
<script>
$(function(){
$("#shortthemes a").click(function(e){
e.preventDefault();
$("link#theme").attr('href',$(this).attr('href'));
$("#shortthemes a").removeClass('selected');
$(this).addClass('selected');
});
});
function tstconfirm(){
smoke.confirm('Confirm as Friend !',function(e){
if (e){
alert('Friend Request Accepted');
}else{
alert('Friend Request Rejected');
}
});
}
</script>
After a lot googling i acheived to send a request to add as friend, say user a sends a friend request to user b and user b logs in he will see the request from user a ... say only his name is displayed when the user clicks on that name a dialog box is opened which will ask the user whether to accpet or reject that request, the problem i am facing right now is i am not able to find how can i update the friends table status column from pending to accepted i.e when the alert message Friend request accepted is displayed the status column of friends table should be updated from pending to accepted and if rejected it should update the status column as rejected
please guide me through this
<script>
$(function(){
$("#shortthemes a").click(function(e){
e.preventDefault();
$("link#theme").attr('href',$(this).attr('href'));
$("#shortthemes a").removeClass('selected');
$(this).addClass('selected');
});
});
function tstconfirm(){
smoke.confirm('Confirm as Friend !',function(e){
if (e){
alert('Friend Request Accepted');
}else{
alert('Friend Request Rejected');
}
});
}
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对 PHP 文件进行发布,该文件处理您的发布请求并更新数据库:
在您的friend_actions.php 中添加:
PHP 文件返回一个URL。 Javascript 检查响应是否小于 100 个字符(否则可能是一个错误,并警告它进行调试),如果是,它会将您重定向到 URL。
Do a post to a PHP-file which handles your Post-request and updates the database:
In your friend_actions.php add:
The PHP-file returns a URL. The Javascript checks if the response is <100 characters (else it's probably an error and it alerts it for debugging) and if so, it redirects you to the URL.