Example: Embed Multiple Intelligent Advisor Interviews On a Web Page

The following example creates a web page which embeds three Intelligent Advisor interviews using the deployments policy1, policy2 and policy3. It starts new interviews on policy1 and policy2 and resumes an existing interview for policy3.

<script src="https://myserver/web-determinations/staticresource/interviews.js"></script>
<div style="display: inline-block; width:100%">
   <div id="embedded" style="border: 1px solid black; width: 49%; display: block; margin-left: auto; margin-right:auto; float: left"></div>
   <div id="embedded2" style="border: 1px solid black; width: 49%; display: block; margin-left: auto; margin-right:auto; float: right"></div></div>
   <div id="embedded3" style="border: 1px solid black; width: 100%; display: block; margin-left: auto; margin-right:auto;"></div>
<script>
   var webDeterminationsUrl = "https://myserver/web-determinations";

   //This method is passed as the "onNavigate" parameter to handle exit/redirect../save and redirect
        function doExit(url){
            //navigate current page to specified url
            window.location = url;
        }

   var startConfig = [
            {
                operation: "start",
                el: document.getElementById("embedded"),
                deploymentName: "policy1",
                onNavigate: doExit
            },
            {
                operation: "start",
                el: document.getElementById("embedded2"),
                deploymentName: "policy2",
                onNavigate: doExit
            },
            {
                operation: "resume",
                el: document.getElementById("embedded3"),
                deploymentName: "policy3",
                locale: "fr-FR",
                params:  {
                    checkpointId: "1",
                    param1: "foo",
                    param2: "bar"
                },
                seedData: {
                    urlparam: "Hey",
                    urlparam2: "There!"
                },
                onNavigate: doExit
            }
        ];

   OraclePolicyAutomationInterview.BatchStartOrResume(webDeterminationsUrl, startConfig);
</script>