<?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 How to retrieve the value of a token in JavaScript via jQuery? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325361#M21009</link>
    <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;In the HTML I have included a SEARCH and set the data result in a TOKEN through the below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var search1 = new SearchManager({
            "id": "search1",
            "earliest_time": "-15m@m",
            "sample_ratio": null,
            "cancelOnUnload": true,
            "latest_time": "now",
            "search": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            "status_buckets": 0,
            "app": utils.getCurrentApp(),
            "auto_cancel": 90,
            "preview": true,
            "runWhenTimeIsUndefined": false
        }, {tokens: true, tokenNamespace: "submitted"});


    new SearchEventHandler({
        managerid: "search1",
        event: "finalized",
        conditions: [
            {
                attr: "any",
                value: "*",
                actions: [
                    {"type": "set", "token": "status_execucao", "value": "$result.data_range$"}
                ]
            }
        ]
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now I am trying to retrieve the value of this token in the JS via jQuery but am not able to do that.&lt;/P&gt;

&lt;P&gt;Which command should I use to retrieve the token via jQuery?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;$('#status_execucao').get()&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;Many thanks and regards,&lt;BR /&gt;
Danillo Pavan&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jan 2018 21:13:52 GMT</pubDate>
    <dc:creator>danillopavan</dc:creator>
    <dc:date>2018-01-23T21:13:52Z</dc:date>
    <item>
      <title>How to retrieve the value of a token in JavaScript via jQuery?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325361#M21009</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;

&lt;P&gt;In the HTML I have included a SEARCH and set the data result in a TOKEN through the below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var search1 = new SearchManager({
            "id": "search1",
            "earliest_time": "-15m@m",
            "sample_ratio": null,
            "cancelOnUnload": true,
            "latest_time": "now",
            "search": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            "status_buckets": 0,
            "app": utils.getCurrentApp(),
            "auto_cancel": 90,
            "preview": true,
            "runWhenTimeIsUndefined": false
        }, {tokens: true, tokenNamespace: "submitted"});


    new SearchEventHandler({
        managerid: "search1",
        event: "finalized",
        conditions: [
            {
                attr: "any",
                value: "*",
                actions: [
                    {"type": "set", "token": "status_execucao", "value": "$result.data_range$"}
                ]
            }
        ]
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now I am trying to retrieve the value of this token in the JS via jQuery but am not able to do that.&lt;/P&gt;

&lt;P&gt;Which command should I use to retrieve the token via jQuery?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;$('#status_execucao').get()&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;Many thanks and regards,&lt;BR /&gt;
Danillo Pavan&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 21:13:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325361#M21009</guid>
      <dc:creator>danillopavan</dc:creator>
      <dc:date>2018-01-23T21:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve the value of a token in JavaScript via jQuery?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325362#M21010</link>
      <description>&lt;P&gt;@danillopavan, first off, which version of Splunk are you on?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;finalized&lt;/CODE&gt; search event handler was used in Splunk versions 6.4 and before. Post 6.5 you should use done instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  event: "done",
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Option 1&lt;/STRONG&gt;: If the token &lt;CODE&gt;status_execucao&lt;/CODE&gt; is already set by the time your JavaScript code tries to access the token, then depending on token model (&lt;CODE&gt;default&lt;/CODE&gt; or &lt;CODE&gt;submitted&lt;/CODE&gt;) you can use Splunk JS stack to &lt;CODE&gt;get&lt;/CODE&gt; and &lt;CODE&gt;set&lt;/CODE&gt; tokens (&lt;A href="http://dev.splunk.com/view/webframework-developapps/SP-CAAAEW3"&gt;http://dev.splunk.com/view/webframework-developapps/SP-CAAAEW3&lt;/A&gt;).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;// Access the "default" token model
var defaultTokenModel = mvc.Components.get("default");

// Retrieve the value of a token $status_execucao$
var tokenValue = defaultTokenModel.get("status_execucao");
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Option 2&lt;/STRONG&gt;: You can use Splunk JS stack to get the token value in JavaScript using token &lt;CODE&gt;change()&lt;/CODE&gt; event (&lt;A href="http://dev.splunk.com/view/SP-CAAAEW4):"&gt;http://dev.splunk.com/view/SP-CAAAEW4):&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    // Access the "default" token model
    var defaultTokenModel = mvc.Components.get("default");
    defaultTokenModel.on("change:status_execucao", function(newTokenName, status_execucao, options) {
        if(status_execucao!==undefined &amp;amp;&amp;amp; status_execucao!=="$result.data_range$"){
            console.log("status_execucao: ",status_execucao);
        }
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out and confirm!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 13:33:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325362#M21010</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-01-24T13:33:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve the value of a token in JavaScript via jQuery?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325363#M21011</link>
      <description>&lt;P&gt;Hello Niketnilay,&lt;/P&gt;

&lt;P&gt;thanks for your support. I have tried to use the commands however it is appearing the error message:&lt;/P&gt;

&lt;P&gt;Uncaught TypeError: Cannot read property 'get' of undefined&lt;/P&gt;

&lt;P&gt;I have included the below dependencies:&lt;/P&gt;

&lt;P&gt;require(['jquery','splunkjs/mvc','backbone'], function($) {&lt;/P&gt;

&lt;P&gt;and the commands:&lt;/P&gt;

&lt;P&gt;var mvc =  require("splunkjs/mvc");&lt;BR /&gt;
 var defaultTokenModel = mvc.Components.get("default");&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 14:41:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325363#M21011</guid>
      <dc:creator>danillopavan</dc:creator>
      <dc:date>2018-01-24T14:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve the value of a token in JavaScript via jQuery?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325364#M21012</link>
      <description>&lt;P&gt;@danillopavan, are you using HTML dashboard or Simple XML JavaScript extension? As per your question it seemed like you are using HTML Dashboard which implies &lt;CODE&gt;mvc&lt;/CODE&gt; should already be included.&lt;/P&gt;

&lt;P&gt;Here is one of my previous answers for Option 1: &lt;A href="https://answers.splunk.com/answers/580205/how-to-get-search-idjobsid-from-xml-dashboard-in-j.html"&gt;https://answers.splunk.com/answers/580205/how-to-get-search-idjobsid-from-xml-dashboard-in-j.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;And here is a recent answer for Option 2: &lt;A href="https://answers.splunk.com/answers/612296/how-to-change-the-header-color-dynamically-using-j.html#answer-613388"&gt;https://answers.splunk.com/answers/612296/how-to-change-the-header-color-dynamically-using-j.html#answer-613388&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Following is a run anywhere example of HTML Dashboard similar to the one described by you&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="utf-8" /&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&amp;gt;
    &amp;lt;title&amp;gt;Splunk Answers 612600 - Token in JavaScript HTML&amp;lt;/title&amp;gt;
    &amp;lt;link rel="shortcut icon" href="/en-US/static/@C9557AB367E3A59ED9840F5616383BD13B651EF2B463EB6C7F025F5CAFE14161/img/favicon.ico" /&amp;gt;
    &amp;lt;link rel="stylesheet" type="text/css" href="{{SPLUNKWEB_URL_PREFIX}}/static/build/css/bootstrap-enterprise.css" /&amp;gt;
    &amp;lt;link rel="stylesheet" type="text/css" href="{{SPLUNKWEB_URL_PREFIX}}/static/css/build/pages/dashboard-simple-bootstrap.min.css" /&amp;gt;


        &amp;lt;meta name="referrer" content="never" /&amp;gt;
        &amp;lt;meta name="referrer" content="no-referrer" /&amp;gt;

          &amp;lt;script&amp;gt;
                window._splunk_metrics_events = {
                   push : function() {},
                   active: false,
                   }
          &amp;lt;/script&amp;gt;
    &amp;lt;/head&amp;gt;
&amp;lt;body class="simplexml preload locale-en" data-splunk-version="7.0.1" data-splunk-product="enterprise"&amp;gt;
&amp;lt;!-- 
BEGIN LAYOUT
This section contains the layout for the dashboard. Splunk uses proprietary
styles in &amp;lt;div&amp;gt; tags, similar to Bootstrap's grid system. 
--&amp;gt;
&amp;lt;header&amp;gt;
    &amp;lt;a class="navSkip" href="#navSkip" tabindex="1"&amp;gt;Screen reader users, click here to skip the navigation bar&amp;lt;/a&amp;gt;
    &amp;lt;div class="header splunk-header"&amp;gt;
            &amp;lt;div id="placeholder-splunk-bar"&amp;gt;
                &amp;lt;a href="{{SPLUNKWEB_URL_PREFIX}}/app/launcher/home" class="brand" title="splunk &amp;amp;gt; listen to your data"&amp;gt;splunk&amp;lt;strong&amp;gt;&amp;amp;gt;&amp;lt;/strong&amp;gt;&amp;lt;/a&amp;gt;
            &amp;lt;/div&amp;gt;
                &amp;lt;div id="placeholder-app-bar"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;a id="navSkip"&amp;gt;&amp;lt;/a&amp;gt;
&amp;lt;/header&amp;gt;
&amp;lt;div class="dashboard-body container-fluid main-section-body" data-role="main"&amp;gt;
    &amp;lt;div class="dashboard-header clearfix"&amp;gt;
        &amp;lt;h2&amp;gt;Token in JavaScript HTML&amp;lt;/h2&amp;gt;
    &amp;lt;/div&amp;gt;


    &amp;lt;div id="row1" class="dashboard-row dashboard-row1"&amp;gt;
        &amp;lt;div id="panel1" class="dashboard-cell" style="width: 100%;"&amp;gt;
            &amp;lt;div class="dashboard-panel clearfix"&amp;gt;

                &amp;lt;div class="panel-element-row"&amp;gt;
                    &amp;lt;div id="element1" class="dashboard-element table" style="width: 100%"&amp;gt;
                        &amp;lt;div class="panel-body"&amp;gt;&amp;lt;/div&amp;gt;
                    &amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;!-- 
END LAYOUT
--&amp;gt;

&amp;lt;script src="{{SPLUNKWEB_URL_PREFIX}}/config?autoload=1" crossorigin="use-credentials"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src="{{SPLUNKWEB_URL_PREFIX}}/static/js/i18n.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src="{{SPLUNKWEB_URL_PREFIX}}/i18ncatalog?autoload=1"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src="{{SPLUNKWEB_URL_PREFIX}}/static/build/simplexml/index.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript"&amp;gt;
// &amp;lt;![CDATA[
// &amp;lt;![CDATA[
//
// LIBRARY REQUIREMENTS
//
// In the require function, we include the necessary libraries and modules for
// the HTML dashboard. Then, we pass variable names for these libraries and
// modules as function parameters, in order.
// 
// When you add libraries or modules, remember to retain this mapping order
// between the library or module and its function parameter. You can do this by
// adding to the end of these lists, as shown in the commented examples below.

require([
    "splunkjs/mvc",
    "splunkjs/mvc/utils",
    "splunkjs/mvc/tokenutils",
    "underscore",
    "jquery",
    "splunkjs/mvc/simplexml",
    "splunkjs/mvc/layoutview",
    "splunkjs/mvc/simplexml/dashboardview",
    "splunkjs/mvc/simplexml/dashboard/panelref",
    "splunkjs/mvc/simplexml/element/chart",
    "splunkjs/mvc/simplexml/element/event",
    "splunkjs/mvc/simplexml/element/html",
    "splunkjs/mvc/simplexml/element/list",
    "splunkjs/mvc/simplexml/element/map",
    "splunkjs/mvc/simplexml/element/single",
    "splunkjs/mvc/simplexml/element/table",
    "splunkjs/mvc/simplexml/element/visualization",
    "splunkjs/mvc/simpleform/formutils",
    "splunkjs/mvc/simplexml/eventhandler",
    "splunkjs/mvc/simplexml/searcheventhandler",
    "splunkjs/mvc/simpleform/input/dropdown",
    "splunkjs/mvc/simpleform/input/radiogroup",
    "splunkjs/mvc/simpleform/input/linklist",
    "splunkjs/mvc/simpleform/input/multiselect",
    "splunkjs/mvc/simpleform/input/checkboxgroup",
    "splunkjs/mvc/simpleform/input/text",
    "splunkjs/mvc/simpleform/input/timerange",
    "splunkjs/mvc/simpleform/input/submit",
    "splunkjs/mvc/searchmanager",
    "splunkjs/mvc/savedsearchmanager",
    "splunkjs/mvc/postprocessmanager",
    "splunkjs/mvc/simplexml/urltokenmodel"
    // Add comma-separated libraries and modules manually here, for example:
    // ..."splunkjs/mvc/simplexml/urltokenmodel",
    // "splunkjs/mvc/tokenforwarder"
    ],
    function(
        mvc,
        utils,
        TokenUtils,
        _,
        $,
        DashboardController,
        LayoutView,
        Dashboard,
        PanelRef,
        ChartElement,
        EventElement,
        HtmlElement,
        ListElement,
        MapElement,
        SingleElement,
        TableElement,
        VisualizationElement,
        FormUtils,
        EventHandler,
        SearchEventHandler,
        DropdownInput,
        RadioGroupInput,
        LinkListInput,
        MultiSelectInput,
        CheckboxGroupInput,
        TextInput,
        TimeRangeInput,
        SubmitButton,
        SearchManager,
        SavedSearchManager,
        PostProcessManager,
        UrlTokenModel

        // Add comma-separated parameter names here, for example: 
        // ...UrlTokenModel, 
        // TokenForwarder
        ) {

        var pageLoading = true;


        // 
        // TOKENS
        //

        // Create token namespaces
        var urlTokenModel = new UrlTokenModel();
        mvc.Components.registerInstance('url', urlTokenModel);
        var defaultTokenModel = mvc.Components.getInstance('default', {create: true});
        var submittedTokenModel = mvc.Components.getInstance('submitted', {create: true});

        urlTokenModel.on('url:navigate', function() {
            defaultTokenModel.set(urlTokenModel.toJSON());
            if (!_.isEmpty(urlTokenModel.toJSON()) &amp;amp;&amp;amp; !_.all(urlTokenModel.toJSON(), _.isUndefined)) {
                submitTokens();
            } else {
                submittedTokenModel.clear();
            }
        });

        // Initialize tokens
        defaultTokenModel.set(urlTokenModel.toJSON());

        function submitTokens() {
            // Copy the contents of the defaultTokenModel to the submittedTokenModel and urlTokenModel
            FormUtils.submitForm({ replaceState: pageLoading });
        }

        function setToken(name, value) {
            defaultTokenModel.set(name, value);
            submittedTokenModel.set(name, value);
        }

        function unsetToken(name) {
            defaultTokenModel.unset(name);
            submittedTokenModel.unset(name);
        }



        //
        // SEARCH MANAGERS
        //


var search1 = new SearchManager({
            "id": "search1",
            "search": "index=\"_internal\" sourcetype=\"splunkd\" log_level!=\"INFO\" | stats count as Errors",
            "latest_time": "now",
            "cancelOnUnload": true,
            "status_buckets": 0,
            "sample_ratio": 1,
            "earliest_time": "-24h@h",
            "app": utils.getCurrentApp(),
            "auto_cancel": 90,
            "preview": true,
            "tokenDependencies": {
            },
            "runWhenTimeIsUndefined": false
        }, {tokens: true, tokenNamespace: "submitted"});

        new SearchEventHandler({
            managerid: "search1",
            event: "done",
            conditions: [
                {
                    attr: "any",
                    value: "*",
                    actions: [
                        {"type": "set", "token": "tokErrorCount", "value": "$result.Errors$"}
                    ]
                }
            ]
        });


        //
        // SPLUNK LAYOUT
        //

        $('header').remove();
        new LayoutView({"hideSplunkBar": false, "hideFooter": false, "hideChrome": false, "hideAppBar": false})
            .render()
            .getContainerElement()
            .appendChild($('.dashboard-body')[0]);

        //
        // DASHBOARD EDITOR
        //

        new Dashboard({
            id: 'dashboard',
            el: $('.dashboard-body'),
            showTitle: true,
            editable: true
        }, {tokens: true}).render();


        //
        // VIEWS: VISUALIZATION ELEMENTS
        //

        var element1 = new TableElement({
            "id": "element1",
            "count": 20,
            "dataOverlayMode": "none",
            "drilldown": "none",
            "percentagesRow": "false",
            "rowNumbers": "true",
            "totalsRow": "false",
            "wrap": "true",
            "managerid": "search1",
            "el": $('#element1')
        }, {tokens: true, tokenNamespace: "submitted"}).render();

        // Initialize time tokens to default
        if (!defaultTokenModel.has('earliest') &amp;amp;&amp;amp; !defaultTokenModel.has('latest')) {
            defaultTokenModel.set({ earliest: '0', latest: '' });
        }

        submitTokens();

        // Access the "default" token model
        var defaultTokenModel = mvc.Components.get("default");
        defaultTokenModel.on("change:tokErrorCount", function(newTokenName, tokErrorCount, options) {
            if(tokErrorCount!==undefined &amp;amp;&amp;amp; tokErrorCount!=="$result.Errors$"){
                console.log("tokErrorCount: ",tokErrorCount);
            }
        });

        //
        // DASHBOARD READY
        //

        DashboardController.ready();
        pageLoading = false;

    }
);
// ]]&amp;gt;
&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Jan 2018 15:59:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325364#M21012</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-01-24T15:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve the value of a token in JavaScript via jQuery?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325365#M21013</link>
      <description>&lt;P&gt;Hi, yes I am using HTML with jQuery (splunk version 6.4). My HTML is similar to the one that you posted above.&lt;/P&gt;

&lt;P&gt;Not sure if the query is running correctly. Is there any way to ensure the value of the token?&lt;/P&gt;

&lt;P&gt;About the java script file, I need to retrieve the token value to display the value in a element that I have created using jquery/bootstrap...&lt;/P&gt;

&lt;P&gt;How can I get it?&lt;/P&gt;

&lt;P&gt;var status_execucao = document.getElementById('status_execucao');  &lt;/P&gt;

&lt;P&gt;Not working...&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:47:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325365#M21013</guid>
      <dc:creator>danillopavan</dc:creator>
      <dc:date>2020-09-29T17:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve the value of a token in JavaScript via jQuery?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325366#M21014</link>
      <description>&lt;P&gt;Hello Niketnilay,&lt;/P&gt;

&lt;P&gt;Just noted that when I use "defaultTokenModel = mvc.Components.getInstance('submitted')", I got the error in the next line "defaultTokenModel.on("change:status_execucao", function(newTokenName, status_execucao, options)" because the variable defaultTokenModel is not yet setted.&lt;/P&gt;

&lt;P&gt;And when I use  "defaultTokenModel = mvc.Components.getInstance('default')", i am not facing the issue however the tokens are not yet setted, so i am not able to retrieve the values.&lt;/P&gt;

&lt;P&gt;Probably it is happening because there is not enough time to load this code while the search is not yet finished.&lt;/P&gt;

&lt;P&gt;How I can do to load continue the execution of the code only when the search is finished?&lt;/P&gt;

&lt;P&gt;Thanks and regards,&lt;BR /&gt;
Danillo Pavan&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:51:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325366#M21014</guid>
      <dc:creator>danillopavan</dc:creator>
      <dc:date>2020-09-29T17:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve the value of a token in JavaScript via jQuery?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325367#M21015</link>
      <description>&lt;P&gt;Hello Niketnilay, any help? Thanks!!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jan 2018 13:28:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325367#M21015</guid>
      <dc:creator>danillopavan</dc:creator>
      <dc:date>2018-01-30T13:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve the value of a token in JavaScript via jQuery?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325368#M21016</link>
      <description>&lt;P&gt;Hi @danilliopavan, sorry I missed seeing your questions... If you are on &lt;CODE&gt;Splunk 6.4&lt;/CODE&gt; you will not have &lt;CODE&gt;done&lt;/CODE&gt; or &lt;CODE&gt;progress&lt;/CODE&gt; event handler, instead you will have &lt;CODE&gt;preview&lt;/CODE&gt; and &lt;CODE&gt;finalized&lt;/CODE&gt; event handlers. i.e. instead of &lt;CODE&gt;event: "done",&lt;/CODE&gt; you should have the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    event: "finalized",
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Refer to Search Event Handler documentation in Splunk Docs for 6.4.7: &lt;A href="https://docs.splunk.com/Documentation/Splunk/6.4.7/Viz/EventHandlerReference#preview"&gt;https://docs.splunk.com/Documentation/Splunk/6.4.7/Viz/EventHandlerReference#preview&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Also refer to following answer where we had to do several trials and errors to get the working HTML dashboard code from Simple XML: &lt;A href="https://answers.splunk.com/answers/614832/how-to-add-icon-to-a-panel-instead-of-table-so-the.html"&gt;https://answers.splunk.com/answers/614832/how-to-add-icon-to-a-panel-instead-of-table-so-the.html&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 15:44:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-retrieve-the-value-of-a-token-in-JavaScript-via-jQuery/m-p/325368#M21016</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-12T15:44:40Z</dc:date>
    </item>
  </channel>
</rss>

