@inherits Custom.Hybrid.Razor14
@{
// Tell the page that we need the 2sxc Js APIs
Kit.Page.Activate("2sxc.JsCore");
}
<!-- unimportant stuff, hidden -->
Hybrid (Dnn / Oqtane) WebApi Examples... <!-- unimportant stuff, hidden -->
<button type="button" class="btn btn-primary" onclick="callBasicHello(this)">
Get Hello
</button>
<button type="button" class="btn btn-primary" onclick="callSquare(this, 7)">
Square 7
</button> <button type="button" class="btn btn-primary" onclick="callSquare(this, 27)">
Square 27
</button>
<script>
function callBasicHello(moduleContext) {
$2sxc(moduleContext).webApi.fetchJson('app/auto/api/hybrid/hello')
.then(function (results) { alert(results); });
}
function callSquare(moduleContext, original) {
$2sxc(moduleContext).webApi.fetchJson('app/auto/api/hybrid/square?number=' + original)
.then(function (results) { alert(results); });
}
</script>
<!-- unimportant stuff, hidden -->