How to load Disqus API conditionally

March 26, 2016 3:14 pm Published by Leave your thoughts

$(document).ready(function() {
	$('.showDisqus').on('click', function(){   // click 시 disqus 로딩 
		var disqus_shortname = 'hackyacomkr';  // 본인 disqus shortname

                // ajax request to load the disqus javascript
		$.ajax({
	         type: "GET",
	         url: "http://" + disqus_shortname + ".disqus.com/embed.js",
	         dataType: "script",
	         cache: true
	     });

	        $(this).fadeOut();  // remove the show comments button
	});
});

Categorized in:

This post was written by hackya

Leave a Reply

Your email address will not be published. Required fields are marked *