DHTMLX Touch documentation

load(url, call)

loads values from external datasource

Parameters

  • url - data url
    • string
  • type - the type of loaded data: xml, json or other (optional)
    • string
  • call - function that is called after loading (optional)
    • function

Returns

Details

Different count of parameters

Method load can be used with different count of parameters

By default used type will be set to json

comp.load("some/path/data.json");

The same with callback will look as

comp.load("some/path/data.json", function(text, xml, http_request){
  //do something
});

And if you need to specify the loading type, above examples will look as

comp.load("some/path/data.xml", "xml");

or

comp.load("some/path/data.xml", "xml", function(){
  //do something
});

Callback

By default the loading is async., so you will need to use callback, to trigger some action after data loading.

Callback method provides 3 parameters

  • text of response
  • xml object of response - present only if response was a valid xml
  • raw http request object

Post and sync. loading

While load doesn't provide direct ability to use post and sync, it can be done by using parse API

	//sync data loading
	var result = dhx.ajax().sync().get("some.json");
	comp.parse(result.responseText);
	//using POST for data loading
	var result = dhx.ajax().post("mydata.php", "some=value", function(text){
		comp.parse(text);
	});