获取Twitter分享响应

3

我需要为我的客户制作一个奖励功能。如果任何客户分享、关注网站链接,那么我必须存储他们的详细信息。问题是如何判断用户是否分享了内容。任何帮助将不胜感激。

我正在使用以下代码:

twitter.com/share?text=Your+Email+Marketing&url=http://blog.abc.com/your-email-marketing.html
1个回答

2
我已经找到了一个使用jquery.twitterbutton.js的解决方案。
代码:-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script src="http://code.jquery.com/jquery-latest.pack.js" type="text/javascript"></script>
<script src="http://platform.twitter.com/widgets.js"></script>
<script src="jquery.twitterbutton.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
  $('#twitterbutton-example').twitterbutton({
   user:'YourUsername',
   title:'jQuery-Twitter-Button Plugin with callback functions',
   onfollow:function(response){
    $('.twitterbutton-uncontent:visible').hide('fade');
    $('.twitterbutton-content').show('fade');
    $.cookie('tw','followed');
   },
   ontweet:function(response){
     alert("hello");
   },
   onretweet:function(response){

   },
   lang:'en'
  });

});
</script>



</head>

<body>
<div id="twitterbutton-example"></div>
</body>
</html>

点击后会发出警报,但无法在推文成功后响应。 - Sudhir
我检查了你的代码,ontweet函数总是返回true。 - Scramble
它不会起作用,因为Twitter改变了它的行为。 - Menon Jats

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接