@inherits Custom.Hybrid.Razor14
@{
// Tell the page that we need the 2sxc Js APIs
Kit.Page.Activate("2sxc.JsCore");
}
<!-- unimportant stuff, hidden -->
WebApi with Polymorph Editions You often... <!-- unimportant stuff, hidden -->
<button type="button" class="btn btn-primary" onclick="callBasicHello(this, 'live')">
Get Hello from live
</button>
<button type="button" class="btn btn-primary" onclick="callBasicHello(this, 'dev')">
Get Hello from dev
</button>
<script>
function callBasicHello(moduleContext, edition) {
$2sxc(moduleContext).webApi.fetchJson('app/auto/' + edition + '/api/demo/hello')
.then(data => alert(data));
}
</script>
<!-- unimportant stuff, hidden -->