$(function() { var logId = 70418; if(logId != 0) { var diggView = '
\n' + '
\n' + '
\n' + '
0
\n' + '
\n'+ '喜欢就顶一下'; $('.diggButton').append(diggView); $('.btnBury,.btnDigg').click(function(e) { e.preventDefault(); var element = this; $.getJSON("http://service.5d.cn/digg/digging.ashx?id=" + logId + "&type=2&isdigg=" + (this.className == 'btnDigg' ? "true" : "false") + "&jsoncallback=?", function(json) { var counter = $(element).parent().siblings('.counter'); counter.text(parseInt(counter.text()) + parseInt(json.data.value)); alert(json.data.message); }); }); } });