Copyright 2013-2014 All Rights Reserved Theme by www.tbwwir.cn 版權所有
AB模板網(www.tbwwir.cn)專注企業網站模板制作,包括企業pbootcms網站模板,靜態網頁模板,網站源碼下載,HTML網站模板等等。XML地圖 網站地圖 今日更新
免責聲明:本站所有資源(模板、圖片)搜集整理于互聯網或者網友提供,僅供學習與交流使用,如果不小心侵犯到你的權益,請及時聯系我們刪除該資源。
先引入 jq 文件
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
無須使用 API,
把以下代碼放入合適的位置即可,可自定義 css
<button class="support">點贊</button> <!--按鈕---> <div id="support_number">{content:likes}</div> <!--贊數量--> <p class="supported"></p> <!--已贊提示--> <!--ajax--> <script> $('.support').on('click', //綁定事件 function() { $.ajax({ url: '{content:likeslink}', //點贊鏈接 data: { 'likes': 'likes' }, success: function(data) { $('#support_number').load(location.href + " #support_number"); //點贊后刷新#support_number if (data.state) {} else { $(".supported").html("已點贊!") //已贊提示 }}, error: function(xhr, status, error) { console.log(error) } }); }) </script> |