In certain instances, when your web application changes the Document Object Model, your page code must notify IBM Tealeaf of the location where the changes were made.

For Ajax, DHTML, or JavaScript based updates that add or edit Document Object Model elements, the page in which the changes are made must call the following IBM Tealeaf API to register the node change, TLT.rebind.

Note: This call must be made when new nodes are added for which capturing the user interaction is essential. Changes that remove nodes can be processed during normal cleanup when the page is unloaded.

Example code:

<html>

<head>
    <title>Rebind example</title>
    <script type="text/javascript">
        ...
        /* AJAXUpdate will be called after the XMLHttpRequest returns
         * a successful response.
         */
        function AJAXUpdate(responseMarkup) {
            var targetDiv = document.getElementById("target_div");
            if (!targetDiv || !responseMarkup) {
                return;
            }
            targetDiv.innerHtml = responseMarkup;
            if (TLT && TLT.rebind) {
                // Notify Tealeaf of the DOM update.
                TLT.rebind(targetDiv);
            }
        }

        ...
    </script>
</head>

<body>

    ...

    <div id="target_div">Placeholder where the AJAX response markup will be placed.
    </div>

    ...

</body>

</html>


Join The Discussion

Your email address will not be published. Required fields are marked *