This shows you the differences between two versions of the page.
uphp:ajax_generation [2019/07/22 06:50] admin |
uphp:ajax_generation [2021/09/13 05:57] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======AJAX Generation====== | ||
- | AJAX is the standard for Asynchronous Javascript and allows dynamic variables to be loaded into a page. In WattmonOS, the home page uses AJAX to update its parameters once per second. | ||
- | |||
- | Various packages may insert hooks that generate content in the AJAX output. | ||
- | |||
- | ==== Generating AJAX ==== | ||
- | In order to send parameters to the home page, your script should output one or more lines of valid JSON data, with a key and value in the format: | ||
- | <code json> | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | {" | ||
- | {" | ||
- | ], | ||
- | </ | ||
- | |||
- | End each parameter with a comma (,). | ||
- | |||
- | ==== Generating AJAX in Blockly ==== | ||
- | Below is an example script that will increment a global variable ' | ||
- | {{: | ||
- | |||
- | Example output of this: | ||
- | <code json> | ||
- | " | ||
- | </ | ||
- | |||
- | Note that the hook 'In Ajax Generation' | ||
- | |||