@using ToSic.Razor.Blade;
@inherits Custom.Hybrid.Razor14
<!-- unimportant stuff, hidden -->
<div @Sys.PageParts.InfoWrapper()>
@Html.Partial("../shared/DefaultInfoSection.cshtml")
<div @Sys.PageParts.InfoIntro()>
<h2>Pass function parameters with turnOn</h2>
<p>In this page turnOn passes parameters to a JavaScript function. The passed parameters then get deconstructed and used for DOM manipulation.</p>
<br>
In this tutorial you'll learn how to:
<ul>
<li>
Pass parameters to JavaScript functions using turnOn.
</li>
<li>
Deconstruct passed parameters
</li>
</ul>
Look at the text below to see the effect.
</div>
</div>
<div id="turn-on-example">
turnOn Example 1 hasn't started yet.
</div>
<div id="turn-on-example-deconstruct">
turnOn Example 2 hasn't started yet.
</div>
@* Passes the parameters Hello for greeting and World for name in a JSON format and executes the window.turnOnTutorial110.init function *@
@* This tutorial uses turnOn, see turnOn tutorials *@
@{
var data = new {
greeting = "Hello",
name = "World"
};
var dataDemo = new {
greeting = "Hello",
name = "Moon"
};
}
@Kit.Page.TurnOn("window.turnOnTutorial110.init()", data: data)
@Kit.Page.TurnOn("window.turnOnTutorial110.demoDeconstruct()", data: dataDemo)
<script src="@CmsContext.View.Path/110-parameters.js" @Kit.Page.AssetAttributes()></script>
@* Footer *@
@Html.Partial("../Shared/Layout/FooterWithSource.cshtml", new { Sys = Sys })