Reputation: 13
Im using the Disqus comment system and user a small client side javascript to call their rest API and check the number of posts of a given array of URLs. (Below)
The script is running fine on my local machine, however when I move it to my remote server it returns a 400 Bad Request.
Now the strange thing is if I check the request that the very same page tries to send using chrome tools, and paste it into my address bar it works!
Im node/express, the same servers locally and in production.
$(document).ready(function () {
var disqusPublicKey = "xxx";
var disqusShortname = "YYY";
var urlArray = [];
$('.count-comments').each(function () {
var url = $(this).attr('data-disqus-url');
urlArray.push('link:' + url.replace(/\s/g,"%20"));
});
$.ajax({
type: 'GET',
url: "https://disqus.com/api/3.0/threads/set.jsonp",
data: { api_key: disqusPublicKey, forum : disqusShortname, thread : urlArray },
cache: false,
dataType: 'jsonp',
success: function (result) {
Do Something
}
});
});
Any ideas?
Upvotes: 1
Views: 1065
Reputation: 692
Did you update the list of authorized domains at http://disqus.com/api/applications/ ?
Upvotes: 6