0

嗨,我正在尝试使用 fsquare.widget 为foursquare 保存按钮获取监听器。但是网站上的文档很短,所以我无法弄清楚。这是我的代码有什么想法吗?

<!-- Place this anchor tag where you want the button to go -->
<a data-on-load="javascript:test();" href="https://foursquare.com/intent/venue.html"   class="fourSq-widget" data-variant="wide">Save to foursquare</a>

<!-- Place this script somewhere after the anchor tag above. If you have multiple buttons, only include the script once. -->
<script type='text/javascript'>
(function() {
    window.___fourSq = {
        "explicit": false,
        "onReady": function () {
            var widget = new fourSq.widget.SaveTo();
            fourSq.widget.Events.bind("follow", function(){
            //wish something like this worked
                 alert('test');
        });
        }
    };
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.src = 'http://platform.foursquare.com/js/widgets.js';
    s.async = true;
    var ph = document.getElementsByTagName('script')[0];
    ph.parentNode.insertBefore(s, ph);
})();
</script>
4

1 回答 1

0

我只是猜测,但也许它有帮助:

这是你的(foursquares')代码:

    <script type='text/javascript'>
(function() {
    window.___fourSq = {
        "explicit": false,
        "onReady": function () {
            var widget = new fourSq.widget.SaveTo();
            fourSq.widget.Events.bind("follow", function(){
            //wish something like this worked
                 alert('test');
        });
        }
    };
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.src = 'http://platform.foursquare.com/js/widgets.js';
    s.async = true;
    var ph = document.getElementsByTagName('script')[0];
    ph.parentNode.insertBefore(s, ph);
})();
</script>

也许它有助于添加:

"onSaveTo": function () {
        alert("Dunno if that works :D");
    });
    }

希望它有效。如果有人知道真正的答案,我会删除它。

于 2013-09-11T08:12:51.247 回答