aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/comments/api/frontends/count-link/getcommentcount.js
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/comments/api/frontends/count-link/getcommentcount.js')
-rw-r--r--bootstrap/comments/api/frontends/count-link/getcommentcount.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/bootstrap/comments/api/frontends/count-link/getcommentcount.js b/bootstrap/comments/api/frontends/count-link/getcommentcount.js
new file mode 100644
index 0000000..536824c
--- /dev/null
+++ b/bootstrap/comments/api/frontends/count-link/getcommentcount.js
@@ -0,0 +1,19 @@
+// Send AJAX request to backend for a comment count (getcommentcount.js)
+HashOverCountLink.prototype.getCommentCount = function (link, options)
+{
+ // Reference to this HashOver object
+ var hashover = this;
+
+ // Get backend queries
+ var queries = ['url=' + options.url];
+
+ // Backend request path
+ var requestPath = '/countlinkajax';
+
+ // Handle backend request
+ this.ajax ('POST', requestPath, queries, function (json) {
+ if (json['link-text'] !== undefined) {
+ link.textContent = json['link-text'];
+ }
+ }, true);
+};