User Tools

Site Tools


uphp:ajax_generation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

uphp:ajax_generation [2019/07/22 06:49]
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.   All parameters in the AJAX page are [[http://www.json.org|JSON]]-encoded. 
- 
-==== 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> 
-"numeric_key":1, 
-"string_key":"my string", 
-"array_key":[1,5,6], 
-"object_key":{"name":"Joe","age:21"}, 
-"array_object_key":[ 
-  {"name":"Joe","age:21"}, 
-  {"name":"Jane","age:32"} 
-], 
-</code> 
- 
-End each parameter with a comma (,). 
- 
-==== Generating AJAX in Blockly ==== 
-Below is an example script that will increment a global variable 'cnt' and send it to the AJAX output. 
-{{:uphp:home_ajax.png|}} 
- 
-Example output of this: 
-<code json> 
-"cnt":334,  
-</cod> 
uphp/ajax_generation.txt · Last modified: 2021/09/13 05:57 (external edit)