<-- Back to Commands (Variables)
This will return an arrays content as an encoded JSON string ready to be returned via AJAX to a JavaScript function.
e.g.
If you setup a page with the following content:
{VAR(V_RESP())}
{SET(V_RESP(name), John)}
{SET(V_RESP(age), 30)}
{SET(V_RESP(city), London)}
{RETURN({ARRAY_JSON(V_RESP)})}
This can then be accessed via a JavaScript AJAX call using the following code:
udb.ajax.page_json(page_id, "mydata=123", function(d){
var obj = JSON.parse(d.content);
console.log(obj.name, obj.age, obj.city);
});
Number | Name | Default | Type | Description |
---|---|---|---|---|
1 | name | String | The name of the Array to encode |