问题
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.
回答1:
Question answered in place on our dev forums: https://dev.twitter.com/discussions/671
回答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
来源:https://stackoverflow.com/questions/9846651/twitter-callback-web-intents-javascript-events