Creating a Dynamic Mbox

You can create an mbox on a page whose code is changed after the page loads.

Many Rich Internet Applications (RIAs) manipulate HTML after the page has already loaded by using technologies like DHTML and AJAX. For example, after clicking a button, your Web page might display a new section of content. Adobe supports this scenario, allowing you to define dynamic mboxes through its mboxDefine() and mboxUpdate() functions.

For example, if you want to serve content when an HTML node called dynamicElement appears on the page:

<div id="dynamicElement"></div>

Then you could trigger the following script on a JavaScript event:

<script type="text/javascript" > 
mboxDefine('dynamicElement’,'mbox_dynamic’,

'parameter1=value1’); 
mboxUpdate('mbox_dynamic’, 'parameter1=value1’);

</script>

Of note:

  • mboxDefine() defines an HTML element as a container for content to be served.

    This function takes in the unique element id, the mbox name, and any number of parameters. The parameters can be used for targeting by the active campaign, even if not passed in again with a later mboxUpdate() call.

    mboxDefine() does not actually serve content so it should be followed with mboxUpdate().

  • mboxUpdate() retrieves the content from Adobe.

    This function may be called multiple times if you want to further change the content. Like mboxCreate, it takes in the mbox name and any number of parameters.

  • The usual mboxCreate() function only works for HTML elements that exist on the page on the initial load.
  • mboxUpdate() can also be used for mboxes created with mboxCreate() rather than mboxDefine().

This allows the page to update content dynamically after the initial page load.