Foursquare跟随按钮监听器

时间:2013-09-11 07:53:34

标签: javascript jquery api foursquare

您好我正在尝试使用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>

1 个答案:

答案 0 :(得分: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");
    });
    }

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