Example 1 — Calling a List Component
This example loads the news-main component filtered by year and injects the rendered HTML into a target element. It mirrors the getnewsroom() pattern from wc-news.js.
let dtb = $('#ftbl').val();
dtb = dtb.replace('/', '~');
var year = 2024;
var uri = "/components/getjsn/news-main/" + dtb + "/0/yr=" + year + "?usecache=Y";
loadjsn(uri, function(obj) {
if (obj != null) {
$('#pnNews').html(obj.vw);
}
});
Note: loadjsn(url, callback) is a WebCore utility function that performs an AJAX GET and passes the parsed JSON response to your callback. It is available on all pages that include the WebCore JS bundle.