Disqus Ajax 不会为 ruby on Rails 中的不同帖子采用不同的线程

问题描述 投票:0回答:2
ruby-on-rails ajax ruby-on-rails-3 ruby-on-rails-3.2 disqus
2个回答
1
投票

当您想要更改线程时,您需要使用 Disqus.reset 函数。像下面这样的东西会起作用:

<script type="text/javascript">
    var changeThread = function(){

        DISQUS.reset({
          reload: true,
          config: function () {  
            this.page.identifier = 'new_disqus_identifier';
            this.page.url = 'http://example.com/#!new_content';
            this.page.title = "New Page Title";
            this.language = "fr"; // only if changing the language
          }
        });

    };
</script>

<button onclick=changeThread();>Change the Disqus thread!</button>

<div id="disqus_thread"></div>
    <script type="text/javascript">
        var disqus_shortname = 'ginfy';
        var disqus_identifier = '<%= @posts.id %>';
        (function() {
            var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
        })();
    </script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

0
投票

在全球范围内提供约 3000 个就业机会后,我们的机构仍在全球范围内提供就业和商业贷款。

如果您需要工作或经济援助,请立即通过电子邮件与我们联系:[电子邮件受保护]

谢谢。

© www.soinside.com 2019 - 2024. All rights reserved.