<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to wait for my page to load before launching my javascript in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470494#M30898</link>
    <description>&lt;P&gt;@marylenebrey&lt;/P&gt;

&lt;P&gt;I think you have fixed values and respective action against same. So I think we can make it without JavaScript. Can you please take reference of below XML and try again.. Note, I have made little change in search that you have to do also.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Dashboard Example&amp;lt;/label&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;| makeresults | eval Product="1,2,3", dispo="Green,Yellow,Red", Product=split(Product,","),dispo=split(dispo,","), tmp=mvzip(Product,dispo) | mvexpand tmp | eval Product=mvindex(split(tmp,","),0),dispo=mvindex(split(tmp,","),1) | table Product,dispo | transpose header_field=Product | fields -  column&amp;lt;/query&amp;gt;
    &amp;lt;earliest&amp;gt;$time.earliest$&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;$time.latest$&amp;lt;/latest&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;set token="tkn_numberCircle_1"&amp;gt;$result.1$&amp;lt;/set&amp;gt;
      &amp;lt;set token="tkn_numberCircle_2"&amp;gt;$result.2$&amp;lt;/set&amp;gt;
      &amp;lt;set token="tkn_numberCircle_3"&amp;gt;$result.3$&amp;lt;/set&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="time" token="time"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
        $tkn_numberCircle_1$
        &amp;amp;lt;br/&amp;amp;gt;
        $tkn_numberCircle_2$
        &amp;amp;lt;br/&amp;amp;gt;
        $tkn_numberCircle_3$
        &amp;lt;div class="flex_col"&amp;gt;
        &amp;lt;p&amp;gt;search&amp;lt;/p&amp;gt;
        &amp;lt;div class="les_sites"&amp;gt;
         &amp;lt;div class="numberCircle flex_col"&amp;gt;
             &amp;lt;div id="numberCircle_1" style="background-color:$tkn_numberCircle_1$ !important;"&amp;gt;
             &amp;lt;p&amp;gt;$search_1$&amp;lt;/p&amp;gt;
             &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;

         &amp;lt;div class="numberCircle flex_col"&amp;gt;
             &amp;lt;div id="numberCircle_2" style="background-color:$tkn_numberCircle_2$ !important;"&amp;gt;
             &amp;lt;p&amp;gt;$search_2$&amp;lt;/p&amp;gt;
             &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;

         &amp;lt;div class="numberCircle flex_col"&amp;gt;
             &amp;lt;div id="numberCircle_3" style="background-color:$tkn_numberCircle_3$ !important;"&amp;gt;
             &amp;lt;p&amp;gt;$search_3$&amp;lt;/p&amp;gt;
             &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 31 Dec 2019 17:59:50 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2019-12-31T17:59:50Z</dc:date>
    <item>
      <title>How to wait for my page to load before launching my javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470491#M30895</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I want to put dynamic color backgrounds in div.&lt;BR /&gt;
My code work but  somtimes when  my searchs in my XML page are not loaded the color don’t stay in my Dashboard .&lt;/P&gt;

&lt;P&gt;Below my code javascript : &lt;/P&gt;

&lt;P&gt;require([&lt;BR /&gt;
    'underscore',&lt;BR /&gt;
    'jquery',&lt;BR /&gt;
    'splunkjs/mvc',&lt;BR /&gt;
            'splunkjs/mvc/searchmanager',&lt;BR /&gt;
    'splunkjs/mvc/simplexml/ready!'&lt;BR /&gt;
], function(_, $, mvc, SearchManager) {&lt;BR /&gt;
            var defaultTokenModelun = mvc.Components.getInstance('default', {create: true});&lt;BR /&gt;
            var submittedTokenModelun = mvc.Components.getInstance('submitted', {create: true});&lt;BR /&gt;
            function setToken(name, value) {&lt;BR /&gt;
                   var defaultTokenModel = mvc.Components.get('default');&lt;BR /&gt;
                   if (defaultTokenModel) {&lt;BR /&gt;
                   defaultTokenModel.set(name, value);&lt;BR /&gt;
            }&lt;BR /&gt;
            var submittedTokenModel = mvc.Components.get('submitted');&lt;BR /&gt;
            if (submittedTokenModel) {&lt;BR /&gt;
               submittedTokenModel.set(name, value);&lt;BR /&gt;
            }&lt;BR /&gt;
            }&lt;BR /&gt;&lt;BR /&gt;
var dispo = new SearchManager({&lt;BR /&gt;
                       "id": "dispo",&lt;BR /&gt;
                       "preview": "false",&lt;BR /&gt;
  "latest_time": "$time.latest$",&lt;BR /&gt;
                       "earliest_time": "$time.earliest$",&lt;BR /&gt;
                       "cache": "false",&lt;BR /&gt;
  "search": "index=myindex sourcetype=mysourcetype  |eval dispo=case(Somme ==0 , " + '"' + YELLOWGREEN +  '"' + ", Somme &amp;gt; 0 , " + '"' + RED +  '"' + ")|table Product, dispo"&lt;BR /&gt;
           }, {tokens: true});&lt;BR /&gt;
dispo.on('search:done',  function(properties) {&lt;BR /&gt;&lt;BR /&gt;
                         var Availability = dispo.data("results",{ count: 0&lt;BR /&gt;
                        });&lt;BR /&gt;
                        Availability.on("data", function() {&lt;BR /&gt;&lt;BR /&gt;
                                   var disponibilite = Availability.data().rows;&lt;BR /&gt;&lt;BR /&gt;
  Object.keys(disponibilite.map(mysearch =&amp;gt; { &lt;/P&gt;

&lt;P&gt;switch (mysearch[0]) {&lt;BR /&gt;
   case "1" : &lt;BR /&gt;
                                                            document.getElementById("numberCircle_1").style.backgroundColor=mysearch[1]; &lt;BR /&gt;
break;&lt;BR /&gt;
case "2" :&lt;BR /&gt;
                                                            document.getElementById("numberCircle_2").style.backgroundColor=mysearch[1]; &lt;BR /&gt;
break;&lt;BR /&gt;
case "3" :&lt;BR /&gt;
                                                            document.getElementById("numberCircle_3").style.backgroundColor=mysearch[1]; &lt;BR /&gt;
break;&lt;/P&gt;

&lt;P&gt;}&lt;BR /&gt;
  }));&lt;BR /&gt;
});&lt;BR /&gt;
});&lt;BR /&gt;
});&lt;/P&gt;

&lt;P&gt;And my code XML : &lt;BR /&gt;
                    div class="flex_col"&amp;gt;&lt;BR /&gt;
                      p&amp;gt;search&lt;/P&gt;&lt;BR /&gt;
                      div class="les_sites"&amp;gt;&lt;BR /&gt;
                        div class="numberCircle flex_col" &amp;gt;&lt;BR /&gt;
                           div id="numberCircle_1"&amp;gt;&lt;BR /&gt;
                          p&amp;gt;$search_1$&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;
                          /div&amp;gt;&lt;BR /&gt;
                        div&amp;gt;&lt;BR /&gt;
                        div class="numberCircle flex_col" &amp;gt;&lt;BR /&gt;
                        div id="numberCircle_2"&amp;gt;&lt;BR /&gt;
                        p&amp;gt;$search_2$&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;
                        /div&amp;gt;&lt;BR /&gt;
                        /div&amp;gt;&lt;BR /&gt;
                        div class="numberCircle flex_col" &amp;gt;&lt;BR /&gt;
                        div id="numberCircle_3"&amp;gt;&lt;BR /&gt;
                        p&amp;gt;$search_3$&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;
                        /div&amp;gt;&lt;BR /&gt;
                        /div&amp;gt;&lt;BR /&gt;
                      /div&amp;gt;&lt;BR /&gt;
                    /div&amp;gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;How to wait for my page to load before launching my javascript ? &lt;/P&gt;

&lt;P&gt;I tried to use window.load but without success. &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:27:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470491#M30895</guid>
      <dc:creator>marylenebrey</dc:creator>
      <dc:date>2020-09-30T03:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to wait for my page to load before launching my javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470492#M30896</link>
      <description>&lt;P&gt;@marylenebrey &lt;/P&gt;

&lt;P&gt;Can you please share you code in &lt;CODE&gt;code block&lt;/CODE&gt;&lt;BR /&gt;
OR&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CODE BLOCK
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;???&lt;BR /&gt;
Click &lt;CODE&gt;101010&lt;/CODE&gt; icon for formatting.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2019 16:50:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470492#M30896</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-12-30T16:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to wait for my page to load before launching my javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470493#M30897</link>
      <description>&lt;P&gt;Sorry, below my code : &lt;BR /&gt;
&lt;STRONG&gt;Javascript :&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;gt;     require([
&amp;gt;     'underscore',
&amp;gt;     'jquery',
&amp;gt;     'splunkjs/mvc',
&amp;gt;     'splunkjs/mvc/searchmanager',
&amp;gt;     'splunkjs/mvc/simplexml/ready!'
&amp;gt;     ], function(_, $, mvc, SearchManager) {
&amp;gt;       var defaultTokenModelun = mvc.Components.getInstance('default',
&amp;gt; {create: true});
&amp;gt;       var submittedTokenModelun = mvc.Components.getInstance('submitted',
&amp;gt; {create: true});
&amp;gt;       function setToken(name, value) {
&amp;gt;       var defaultTokenModel = mvc.Components.get('default');
&amp;gt;               if (defaultTokenModel) {
&amp;gt;               defaultTokenModel.set(name, value);
&amp;gt;               }
&amp;gt;               var submittedTokenModel = mvc.Components.get('submitted');
&amp;gt;               if (submittedTokenModel) {
&amp;gt;               submittedTokenModel.set(name, value);
&amp;gt;               }
&amp;gt;           }
&amp;gt;       var dispo = new SearchManager({
&amp;gt;       "id": "dispo",
&amp;gt;       "preview": "false",
&amp;gt;       "latest_time": "$time.latest$",
&amp;gt;       "earliest_time": "$time.earliest$",
&amp;gt;       "cache": "false",
&amp;gt;       "search": "index=myindex sourcetype=mysourcetype |eval dispo=case(Somme ==0 , " + '"' +     &amp;gt; YELLOWGREEN + '"' + ", Somme &amp;gt; 0 , " +  '"' + RED + '"' + ")|table Product, dispo" 
&amp;gt;       }, {tokens: true});
&amp;gt;           dispo.on('search:done', function(properties) {
&amp;gt;               var Availability = dispo.data("results",{ count: 0
&amp;gt;               });
&amp;gt;               Availability.on("data", function() {
&amp;gt;               var disponibilite = Availability.data().rows;
&amp;gt;                   Object.keys(disponibilite.map(mysearch
&amp;gt; =&amp;gt; {
&amp;gt;     
&amp;gt;                           switch (mysearch[0]) {
&amp;gt;                           case "1" :
&amp;gt;                           document.getElementById("numberCircle_1").style.backgroundColor=mysearch[1];
&amp;gt;                           break;
&amp;gt;                           case "2" :
&amp;gt;                           document.getElementById("numberCircle_2").style.backgroundColor=mysearch[1];
&amp;gt;                           break;
&amp;gt;                           case "3" :
&amp;gt;                           document.getElementById("numberCircle_3").style.backgroundColor=mysearch[1];
&amp;gt;                           break;
&amp;gt;                           }
&amp;gt;                   }));
&amp;gt;               });
&amp;gt;           });
&amp;gt;     });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;XML :&lt;/STRONG&gt; &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;div class="flex_col"&amp;gt;
&amp;lt;p&amp;gt;search&amp;lt;/p&amp;gt;

    &amp;lt;div class="les_sites"&amp;gt;
        &amp;lt;div class="numberCircle flex_col" &amp;gt;
            &amp;lt;div id="numberCircle_1"&amp;gt;
            &amp;lt;p&amp;gt;$search_1$&amp;lt;/p&amp;gt;
            &amp;lt;div&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div class="numberCircle flex_col" &amp;gt;
            &amp;lt;div id="numberCircle_2"&amp;gt;
            &amp;lt;p&amp;gt;$search_2$
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;

        &amp;lt;div class="numberCircle flex_col" &amp;gt;
            &amp;lt;div id="numberCircle_3"&amp;gt;
            &amp;lt;p&amp;gt;$search_3$&amp;lt;/p&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Dec 2019 08:04:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470493#M30897</guid>
      <dc:creator>marylenebrey</dc:creator>
      <dc:date>2019-12-31T08:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to wait for my page to load before launching my javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470494#M30898</link>
      <description>&lt;P&gt;@marylenebrey&lt;/P&gt;

&lt;P&gt;I think you have fixed values and respective action against same. So I think we can make it without JavaScript. Can you please take reference of below XML and try again.. Note, I have made little change in search that you have to do also.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Dashboard Example&amp;lt;/label&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;| makeresults | eval Product="1,2,3", dispo="Green,Yellow,Red", Product=split(Product,","),dispo=split(dispo,","), tmp=mvzip(Product,dispo) | mvexpand tmp | eval Product=mvindex(split(tmp,","),0),dispo=mvindex(split(tmp,","),1) | table Product,dispo | transpose header_field=Product | fields -  column&amp;lt;/query&amp;gt;
    &amp;lt;earliest&amp;gt;$time.earliest$&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;$time.latest$&amp;lt;/latest&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;set token="tkn_numberCircle_1"&amp;gt;$result.1$&amp;lt;/set&amp;gt;
      &amp;lt;set token="tkn_numberCircle_2"&amp;gt;$result.2$&amp;lt;/set&amp;gt;
      &amp;lt;set token="tkn_numberCircle_3"&amp;gt;$result.3$&amp;lt;/set&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="time" token="time"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
        $tkn_numberCircle_1$
        &amp;amp;lt;br/&amp;amp;gt;
        $tkn_numberCircle_2$
        &amp;amp;lt;br/&amp;amp;gt;
        $tkn_numberCircle_3$
        &amp;lt;div class="flex_col"&amp;gt;
        &amp;lt;p&amp;gt;search&amp;lt;/p&amp;gt;
        &amp;lt;div class="les_sites"&amp;gt;
         &amp;lt;div class="numberCircle flex_col"&amp;gt;
             &amp;lt;div id="numberCircle_1" style="background-color:$tkn_numberCircle_1$ !important;"&amp;gt;
             &amp;lt;p&amp;gt;$search_1$&amp;lt;/p&amp;gt;
             &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;

         &amp;lt;div class="numberCircle flex_col"&amp;gt;
             &amp;lt;div id="numberCircle_2" style="background-color:$tkn_numberCircle_2$ !important;"&amp;gt;
             &amp;lt;p&amp;gt;$search_2$&amp;lt;/p&amp;gt;
             &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;

         &amp;lt;div class="numberCircle flex_col"&amp;gt;
             &amp;lt;div id="numberCircle_3" style="background-color:$tkn_numberCircle_3$ !important;"&amp;gt;
             &amp;lt;p&amp;gt;$search_3$&amp;lt;/p&amp;gt;
             &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Dec 2019 17:59:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470494#M30898</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-12-31T17:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to wait for my page to load before launching my javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470495#M30899</link>
      <description>&lt;P&gt;I thank you for you reply @kamlesh_vaghela .&lt;BR /&gt;
Finally, I passed all of my requests in javascript. This solved my problem.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 10:07:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470495#M30899</guid>
      <dc:creator>marylenebrey</dc:creator>
      <dc:date>2020-01-09T10:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to wait for my page to load before launching my javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470496#M30900</link>
      <description>&lt;P&gt;Great @marylenebrey&lt;/P&gt;

&lt;P&gt;Can you please post your solution as an answer and accept it? It will help community a lot. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Happy Splunking&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2020 11:24:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470496#M30900</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2020-01-09T11:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to wait for my page to load before launching my javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470497#M30901</link>
      <description>&lt;P&gt;As below ma solution  : &lt;/P&gt;

&lt;P&gt;I passed my requests (result of search_1, search_2, search_3 ) from my xml in the javascript :  &lt;/P&gt;

&lt;P&gt;js : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; product.on('search:done', function(properties) {  
        var product1 = product.data("results",{ count: 0
            });
            product1.on("data", function() {   
                var var_products = product1.data().rows;

                Object.keys(var_products.map(var_product =&amp;gt; { 
                    switch (var_product[0]) {
                            case "1" :
                            document.getElementById("product_1").innerText=var_availability1[1]; 
                            break;
                            case "2" :
                            document.getElementById("product_2").innerText=var_availability1[1]; 
                            break;
                            case "3" :
                            document.getElementById("product_3").innerText=var_availability1[1]; 
                            break;

                    }
                }));
        });
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;XML : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;div class="flex_col"&amp;gt;
 &amp;lt;p&amp;gt;search&amp;lt;/p&amp;gt;

     &amp;lt;div class="les_sites"&amp;gt;
         &amp;lt;div class="numberCircle flex_col" &amp;gt;
             &amp;lt;div id="numberCircle_1"&amp;gt;
             &amp;lt;p id="product_1"&amp;gt;$search_1$&amp;lt;/p&amp;gt;
             &amp;lt;div&amp;gt;
         &amp;lt;/div&amp;gt;

         &amp;lt;div class="numberCircle flex_col" &amp;gt;
             &amp;lt;div id="numberCircle_2"&amp;gt;
             &amp;lt;p id="product_2"&amp;gt;$search_2$
             &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;

         &amp;lt;div class="numberCircle flex_col" &amp;gt;
             &amp;lt;div id="numberCircle_3"&amp;gt;
             &amp;lt;p id="product_3"&amp;gt;$search_3$&amp;lt;/p&amp;gt;
             &amp;lt;/div&amp;gt;
         &amp;lt;/div&amp;gt;
     &amp;lt;/div&amp;gt;
 &amp;lt;/div&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem comes from the fact that there was a conflict between my xml and my javascript.&lt;BR /&gt;
If you have the same kind of problem you should either pass everything in XML or pass everything in javascript.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:36:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470497#M30901</guid>
      <dc:creator>marylenebrey</dc:creator>
      <dc:date>2020-09-30T03:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to wait for my page to load before launching my javascript</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470498#M30902</link>
      <description>&lt;P&gt;Just a friendly hint: you added your solution as &lt;CODE&gt;comment&lt;/CODE&gt; what is good as everybody could see it.&lt;BR /&gt;
It would be even better if you convert it to/post it again as an &lt;CODE&gt;answer&lt;/CODE&gt; - that's something different &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
And as a last step you then accept this answer as a solution - so everybody could see right in the search results, that this question already HAS a solution.&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2020 11:14:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-wait-for-my-page-to-load-before-launching-my-javascript/m-p/470498#M30902</guid>
      <dc:creator>rvany</dc:creator>
      <dc:date>2020-05-15T11:14:15Z</dc:date>
    </item>
  </channel>
</rss>

