投票系统Javascript

原创
ithorizon 5个月前 (10-19) 阅读数 39 #Javascript

在 jhoom.xyz 从事一个项目,并且一直停留在我想限制每个 ip 投票的地方。
` function votereview(reviewid, votetype) {
常量数据 = {
行动:'ipf_vote_review',
评论 id:评论 id,
投票类型:投票类型,
postid: id; ?>
};

        jQuery.post('<?php echo admin_url('admin-ajax.php'); ?>', data, function(response) {
            if (response.success) {
                const reviewElement = jQuery('.single-review').eq(reviewId);
                if (voteType === 'up') {
                    let upCount = parseInt(reviewElement.find('.thumb:first').text().match(/\d+/)[0]) + 1;
                    reviewElement.find('.thumb:first').html('👍 (' + upCount + ')');
                } else {
                    let downCount = parseInt(reviewElement.find('.thumb:last').text().match(/\d+/)[0]) + 1;
                    reviewElement.find('.thumb:last').html('👎 (' + downCount + ')');
                }
            } else {
                alert(response.data);
            }
        });
    }

`

以上就是投票系统Javascript的详细内容,更多请关注IT视界其它相关文章!



热门