RyeGuy RyeGuy - 1 year ago 145
HTML Question

jQuery-comments plugin not running

There a exist a brilliant comments plugin that I would like to implement on my site. It can be found here https://github.com/Viima/jquery-comments.

However I am having difficulty getting anything to appear when I try to implement it (first time using a plugin). Any suggestions would be great. Below is my code. (I would provide a JSFiddle however the external resources require links starting with "https.." and mine begin with "http...")


<!doctype html>
<meta name=description content="">
<meta name=viewport content="width=device-width, initial-scale=1">

<link rel="stylesheet" type="text/css" href="http://**MYURL**.net/jquery-comments.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript" src="http://**MYURL**.net/jquery-comments.js"></script>

<div id="comments-container"></div>
<script type="text/javascript">
getComments: function(success, error) {
var commentsArray = [{
id: 1,
created: '2015-10-01',
content: 'Lorem ipsum dolort sit amet',
fullname: 'Simon Powell',
upvote_count: 2,
user_has_upvoted: false

Answer Source

The following part of the code that you have typed has a few issues.

<script rel="text/javascript" href="http://**MYURL**.net/jquery-comments.js"></script>

You are using rel="text/javascript" and href="http://**MYURL**.net/jquery-comments.js" instead of type="text/javascript" and src="http://**MYURL**.net/jquery-comments.js"

Ultimately, you should replace the aforementioned block of code with the following one:

<script type="text/javascript" src="http://**MYURL**.net/jquery-comments.js"></script>

Script tags are using type attribute to indicate the type of document that is called (which isn't really a good practice to use anymore according to latest Javascript standards). Also, in order to load, within the script tags, a Javascript file, you have to use src attribute instead of href.

Compare your code with the following one: https://github.com/Viima/jquery-comments#quick-start

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download