JSTags: async-content-loader Tag

Description

This tag inserts some content asynchronously in the page when it is loaded. It is useful, for example, when some of the content being included in the page may take long to be available.

The content being included in the page can be:

  • html: in this case, it will be inserted directly in the page, as soon as the server sends it.
  • other: if the content is not HTML, you have to provide a JavaScript function that will receive the server response and insert it in the page as the tag does not know how to insert such content. The function being called will receive the parameters:
    • request: by means of this parameter, the server response can be used. Either request.responseXML or request.responseText can be called depending on whether the return content is XML or any other respectively.
    • targetId

Tag reference

Attribute name Description Default Required Valid values
targetId Identifier of the element the content retrieved from the URL will be inserted in. true
url URL the content is loaded from. true
nameValuePairs It contains a ',' separated object of pairs name:value. These parameters will be added, with the value given here, to the request false a String representing a JavaScript-like object. i.e. {name1:'value1',name2:56}
contentType Type of the content being loaded. If HTML it will be inserted in the targetId element automatically. Otherwise, a JavaScript function must be provided to insert such content. true html, other
callbackFc name of the JavaScript function being executed when the content is fetched from the given URL. It inserts such content in the page. false (true if 'contentType' is 'other') i.e. myFunction. In this case, when the content from the url is retrieved, myFunction will be called the following way: myFunction(request, targetId)

Note: all of the attributes accept runtime expressions.