X
X
xenofobius2017-02-04 20:03:08
JavaScript
xenofobius, 2017-02-04 20:03:08

Javascript $.getScript how to download script from disqus?

I ran into a problem loading the script from disqus, the content on the site is loaded via load, respectively, the scripts do not work after loading, I use getScript after the content is loaded into the block, the scripts from the server are loaded and executed normally, however, a script is used to display the number of comments for a certain article on the page (taken from the website):

<script id="dsq-count-scr" src="//gags-hol-es.disqus.com/count.js" async></script>

When the page loads, the number of comments is displayed correctly, but how can I implement loading the script dynamically after loading the ajaxom content?
something like this:
$.getScript("https://gags-hol-es.disqus.com/count.js");

Well, or maybe there are more trivial solutions +)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
ksenofobius, 2017-02-04
@ksenofobius

Not suitable, as I understand it, the script is not executed because gags-hol-es.disqus.com/count.js is bound to a specific id, id="dsq-count-scr", you can somehow specify it in getscript ? I tried that too

var script = document.createElement('script');
script.setAttribute("id", "dsq-count-scr");

well, further in the code, the effect is similar

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question