点赞和取消赞不刷新页面的方法
来源:互联网 发布:pdf转jpg软件 编辑:程序博客网 时间:2024/04/30 13:05
//点赞
$(".log_digg").on('click', function () {
var post_id = $(this).parent().parent().find(".post_id").val();
var log_digg_num =$(this).find(".log_digg_num_"+post_id).html();
log_digg_num=parseInt(log_digg_num);
var text = $(this).find(".digg_text_"+post_id).text();
if(text=="点赞"){
$.post(URL_PATH+"/index/Index/digg_log",{'post_id':post_id},function(data){
var data=JSON.parse(data);//接收解码的数据
if(data.code=="200"){
alert(data.msg);
log_digg_num = log_digg_num+1;
$(".log_digg_num_"+post_id).html(log_digg_num);
$(".digg_text_"+post_id).text('取消点赞');
}
else
{
alert('点赞失败');
}
});
}
else{
$.post(URL_PATH+"/index/Index/cancel_digg_log",{'post_id':post_id},function(data){
var data=JSON.parse(data);//接收解码的数据
if(data.code=="200"){
alert(data.msg);
log_digg_num = log_digg_num-1;
$(".log_digg_num_"+post_id).html(log_digg_num);
$(".digg_text_"+post_id).text('点赞');
}
else
{
alert('取消点赞失败');
}
});
}
})
$(".log_digg").on('click', function () {
var post_id = $(this).parent().parent().find(".post_id").val();
var log_digg_num =$(this).find(".log_digg_num_"+post_id).html();
log_digg_num=parseInt(log_digg_num);
var text = $(this).find(".digg_text_"+post_id).text();
if(text=="点赞"){
$.post(URL_PATH+"/index/Index/digg_log",{'post_id':post_id},function(data){
var data=JSON.parse(data);//接收解码的数据
if(data.code=="200"){
alert(data.msg);
log_digg_num = log_digg_num+1;
$(".log_digg_num_"+post_id).html(log_digg_num);
$(".digg_text_"+post_id).text('取消点赞');
}
else
{
alert('点赞失败');
}
});
}
else{
$.post(URL_PATH+"/index/Index/cancel_digg_log",{'post_id':post_id},function(data){
var data=JSON.parse(data);//接收解码的数据
if(data.code=="200"){
alert(data.msg);
log_digg_num = log_digg_num-1;
$(".log_digg_num_"+post_id).html(log_digg_num);
$(".digg_text_"+post_id).text('点赞');
}
else
{
alert('取消点赞失败');
}
});
}
})
0 2
- 点赞和取消赞不刷新页面的方法
- 刷新页面出现重试和取消解决方法
- 搜集过防止用户点“后退”和刷新页面的一些方法
- 类似qq空间的点赞和取消赞
- 一段实现DataGrid的“编辑”、“取消”功能脚本,目的是不产生页面刷新
- 一段实现DataGrid的“编辑”、“取消”功能脚本,目的是不产生页面刷新
- 一段实现DataGrid的“编辑”、“取消”功能脚本,目的是不产生页面刷新
- 取消页面刷新时产生的声音
- 不刷新页面查询数据库中数据的方法
- 不刷新页面改变验证码的两种方法
- 使用iframe提交表单不刷新页面的方法
- IE中页面无法刷新,方法不执行的解决办法
- 页面刷新的方法
- 刷新页面的方法
- 提交表单提示框确定取消 点取消不会刷新页面
- jquery点赞和取消点赞插件
- js中页面刷新和页面跳转的方法总结
- a href 页面不刷新方法
- [LeetCode]147. Insertion Sort List
- android中 字体颜色设置
- VC 域名解析成ip地址
- linux系统/网络编程
- Tomcat学习
- 点赞和取消赞不刷新页面的方法
- axure生成的HTML可以直接用吗
- Centos 6.5 安装java及设置默认jdk版本
- 素数
- Redis源码剖析--数据库db
- linux 下解决umount 时出现的 "Device is busy"问题
- 数据库范式-例子很好
- [LeetCode]160. Intersection of Two Linked Lists
- 【Qt】QString之simplified()小记