DFrameAPI: getContent: Loads a file and launch the DFrameAPI.onContentLoad function.
DFrameAPI: onContentLoad: Launched each time a file has been loaded with the DFrameAPI.getContent method.
Example
…
DFrameAPI.getContent('./advanced.XML/contacts_XML.html', 'load1')
…
DFrameAPI.onContentLoad = function(contentValue, key) {
if (key == 'load1') {
…
}
}
Demo
file: getContent.html
Run the example
See the source code
DFrame.getContent(url[, key])
url
getContent method. The
url of the document whose content is to be loaded.
contentValue
onContentLoad function. String. The content of the loaded document.
key
getContent method and onContentLoad function. String: Used if many contents are loaded: As the onContentLoad function is launched by dFrameAPI each time a content is loaded this key will allow the developper to distinguish which content is loaded.
Example:
…
DFrameAPI.getContent(url1, 'load1')
…
DFrameAPI.getContent(url2, 'load2')
…
DFrameAPI.onContentLoad = function(contentValue, key) {
if (key == 'load1') {
…
} else if (key == 'load2') {
…
}
}
getContent: No return value.
The main usage of those 2 syntaxes is to load XML strings: See the advanced.XML.html sample in the tutorial.