API & User Input Demo

The form below sends your input to a JS Module API (located at modules/api/demo-api.js), which processes the data and returns a JSON response.

Raw JSON Response from Server:

How it works

  1. The Logic: modules/api/demo-api.js handles the request and returns bx.render.JSON().
  2. The Trigger: setEvents() maps the button click to a JavaScript function.
  3. The Transport: The API utility handles the asynchronous fetch to the server using a modern action-based contract.