String / Function(treeId, treeNode)setting.async.url

Overview[ depends on jquery.ztree.core js ]

The URL to which the ajax request is sent. It is valid when [setting.async.enable = true]

Default: ""

String Format

A url string(e.g. "http://www.domain.com/cgi-bin/my-script.cgi"). Note: please check that the url can be loaded with a browser

Url can also take parameters, please note that they need to be urlencoded.

Function Parameter Descriptions

treeIdString

zTree unique identifier: treeId.

treeNodeJSON

Parent node's JSON data object

When asynchronously loading the root, the treeNode = null

Return String

Return value is same as 'String Format'

Examples of setting & function

1. set ajax url is "nodes.php"

var setting = {
	async: {
		enable: true,
		url: "nodes.php",
		autoParam: ["id", "name"]
	}
};
......

2. set ajax url is "function"

function getAsyncUrl(treeId, treeNode) {
    return treeNode.isParent ? "nodes1.php" : "nodes2.php";
};
var setting = {
	async: {
		enable: true,
		url: getAsyncUrl,
		autoParam: ["id", "name"]
	}
};
......