I've made a few revisions - mostly stabs in the dark, but got rid of the 404 response. Now I'm getting 400 (Bad Request) in response from the API. Would really appreciate if anybody who's been through similar growing pains is able to share some wisdom. I don't understand why it's unhappy with the request.
<#assign boardID = coreNode.id />
<button id="subscribe">Subscribe</button>
<@liaAddScript>
(function($){
$(document).ready(function(){
$("#subscribe").on( "click", function() {
$.ajax({
type: 'post',
url: "/api/2.0/subscriptions",
dataType: 'json',
data: JSON.stringify({
"type":"subscription",
"target":{
"type":"board",
"id":"${boardID}"
}
})
}).done(function(response) {
console.log('Success');
}).fail(function(response) {
console.log('Fail');
})
});
});
})(LITHIUM.jQuery);
</@liaAddScript>