1

Is it possible to pass some variables to the called function,

it tried it like this but failed

<script type="text/javascript">
twttr.ready(function (twttr) {
twttr.events.bind('tweet', twitnshare('tws_likings', '<?php echo $sess_uid;?>', href));
});</script>

If its not possible, whats the way out.

0

Question answered in place on our dev forums: https://dev.twitter.com/discussions/671

  • Thanks for the great help.. but still am stuck somewhere.. The tweet button is in a while loop as the posts has to loaded with a while loop, so tweet button is then attached to every post accordingly.. Surely it fires the event but don't know why it fires 10 times.. Element id has to be same every time because it has been defined only once.. Getting 10 similar entries in the dayabase with every new tweet.. – harry Mar 27 '12 at 17:53
2

Usually if the events binding is not working i have found ppl missing the assign to windows.twttr before binding an event to it. First do this :

window.twttr = (function (d,s,id) {
  var t, js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return; js=d.createElement(s); js.id=id;
  js.src="https://platform.twitter.com/widgets.js"; fjs.parentNode.insertBefore(js, fjs);
  return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } });
}(document, "script", "twitter-wjs"));

Than do the bindings:

twttr.ready(function (twttr) {
twttr.events.bind('tweet', function (event) { //add ur post tweet stuff here } );
});

Following links might help : https://dev.twitter.com/docs/intents/events#events

https://dev.twitter.com/discussions/671

  • This solved it. Only other thing--make sure the platform.twitter.com script is http rather than https if you're not secure. – Amalgovinus Sep 20 '13 at 21:57

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.