Displays HTML content and waits for the user to respond. Once displayed, the screen can be submitted back to the server with the use of the pui.submit() client-side browser API.
The content is defined using an EJS Template. The template is populated using the strongly typed fields declared within the global scope of the Node.js module or using the data parameter. Since Profound.js applications are single page applications, the content should not be a full HTML document and must not include <html>
, <title>
, and <body>
tags. It should only include the body content to render. The browser page will not be reloaded.
|
<h1> Calculate Square of a Number </h1> <br/> Enter a number: <input type="text" name="number" value="<%= number %>" /> <br/> The square is: <%= square %> <input type="button" value="Calculate" onclick="pui.submit()" /> <input type="button" value="Exit" onclick="pui.submit('exit')" /> |
pjs.define("number", { type: "integer" }); pjs.define("square", { type: "integer" }); pjs.define("exit", { type: "boolean" }); while (!exit) { pjs.display("calculate_square.html"); square = number * number; } |
pjs.define("number", { type: "integer" }); pjs.define("square", { type: "integer" }); pjs.define("exit", { type: "boolean" }); while (!exit) { pjs.display("calculate_square.html", { number: number, square: square }); square = number * number; } |