<?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 use the JavaScript to send requests to Splunk and have Splunk execuse SPL? in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-use-the-JavaScript-to-send-requests-to-Splunk-and-have/m-p/670929#M18024</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/261598"&gt;@quentin_young&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use this link for&amp;nbsp;Splunk Web Framework Component Reference.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/DocumentationStatic/WebFramework/1.0/" target="_blank"&gt;https://docs.splunk.com/DocumentationStatic/WebFramework/1.0/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;JQuery:&amp;nbsp;&lt;A href="https://www.w3schools.com/jquery/default.asp" target="_blank"&gt;https://www.w3schools.com/jquery/default.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Splunk UI Toolkit:&amp;nbsp;&lt;A href="https://splunkui.splunk.com/home" target="_blank"&gt;https://splunkui.splunk.com/home&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Integrating jQuery DataTables Into Splunk:&lt;/P&gt;&lt;P&gt;&lt;A href="https://hurricanelabs.com/splunk-tutorials/integrating-jquery-datatables-into-splunk-tutorial-part-1/" target="_blank"&gt;https://hurricanelabs.com/splunk-tutorials/integrating-jquery-datatables-into-splunk-tutorial-part-1/&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and so on.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Happy Learning&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if you face any issues, just let us know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;If any of my replies help you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Dec 2023 05:41:37 GMT</pubDate>
    <dc:creator>kamlesh_vaghela</dc:creator>
    <dc:date>2023-12-06T05:41:37Z</dc:date>
    <item>
      <title>How to use the JavaScript to send requests to Splunk and have Splunk execuse SPL?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-use-the-JavaScript-to-send-requests-to-Splunk-and-have/m-p/670409#M17962</link>
      <description>&lt;P&gt;I customize a dashboard page and I put a submit button on it.How can I use the Javascript monitor the button's click to send a request to Splunk and have Splunk execuse a SPL?&lt;/P&gt;
&lt;P&gt;This is my Js code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;require([
	"jquery",
], function ($) {
	$(document).on('click', '#btn_submit',
		function () {
			setTimeout(function time() {
				var temp_a = document.getElementById('temp_a').value
				var temp_b = document.getElementById('temp_b').value
			},
				100);
		});
});&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and the dashboard source code is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard script="test.js"&amp;gt;
    &amp;lt;label&amp;gt;test_js_action&amp;lt;/label&amp;gt;
    &amp;lt;row&amp;gt;
        &amp;lt;panel&amp;gt;
            &amp;lt;html&amp;gt;
                &amp;lt;div&amp;gt;
                    &amp;lt;button id="btn_submit"&amp;gt;submit&amp;lt;/button&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/html&amp;gt;
        &amp;lt;/panel&amp;gt;
    &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, I saw a sample using the splunkjs/mvc to send request ,but I cant't get whole code. only know the Js head is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;require([
	"jquery",
	"splunkjs/mvc",
	"splunkjs/mvc/simplexml/ready!"
], function ($, mvc) {&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much if you could provide a solution.&lt;span class="lia-unicode-emoji" title=":rose:"&gt;🌹&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 10:06:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-use-the-JavaScript-to-send-requests-to-Splunk-and-have/m-p/670409#M17962</guid>
      <dc:creator>quentin_young</dc:creator>
      <dc:date>2023-12-01T10:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the JavaScript to send requests to Splunk and have Splunk execuse SPL?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-use-the-JavaScript-to-send-requests-to-Splunk-and-have/m-p/670420#M17963</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/261598"&gt;@quentin_young&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sharing my sample code. please check the console for results.&lt;/P&gt;&lt;P&gt;test_js_action.js&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    "splunkjs/mvc/searchmanager",
    'splunkjs/mvc/simplexml/ready!'
], function (_, $, mvc, SearchManager) {

    var mySearch = new SearchManager({
        id: "mysearch",
        autostart: "false",
        search: '| makeresults | eval test = "This is test" ',
        preview: false,
    }, { tokens: true, tokenNamespace: "submitted" });

    var mySearchResults = mySearch.data("results");
    mySearchResults.on("data", function () {
        resultArray = mySearchResults.data().rows;
        console.log("My Data", resultArray);
    });

    $(document).ready(function () {
        $("#btn_submit").on("click", function () {
            // Capture value of the Text Area
            console.log("button clicked");
            mySearch.startSearch();
        });
    });
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;XML&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard version="1.1" script="test_js_action.js"&amp;gt;
  &amp;lt;label&amp;gt;test_js_action&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
                &amp;lt;div&amp;gt;
                    &amp;lt;button id="btn_submit"&amp;gt;submit&amp;lt;/button&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this will help you.&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;If any of my replies help you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 06:10:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-use-the-JavaScript-to-send-requests-to-Splunk-and-have/m-p/670420#M17963</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2023-12-01T06:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the JavaScript to send requests to Splunk and have Splunk execuse SPL?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-use-the-JavaScript-to-send-requests-to-Splunk-and-have/m-p/670608#M17979</link>
      <description>Thank you very much for your response,I will try it tomorrow.</description>
      <pubDate>Mon, 04 Dec 2023 09:43:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-use-the-JavaScript-to-send-requests-to-Splunk-and-have/m-p/670608#M17979</guid>
      <dc:creator>quentin_young</dc:creator>
      <dc:date>2023-12-04T09:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the JavaScript to send requests to Splunk and have Splunk execuse SPL?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-use-the-JavaScript-to-send-requests-to-Splunk-and-have/m-p/670921#M18023</link>
      <description>&lt;P&gt;Your reply has solved my problem. Thank you very much. Also, there is a small request. Could you provide me with some relevant documents on using JavaScript in Splunk. Thank you again.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 02:47:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-use-the-JavaScript-to-send-requests-to-Splunk-and-have/m-p/670921#M18023</guid>
      <dc:creator>quentin_young</dc:creator>
      <dc:date>2023-12-06T02:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to use the JavaScript to send requests to Splunk and have Splunk execuse SPL?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/How-to-use-the-JavaScript-to-send-requests-to-Splunk-and-have/m-p/670929#M18024</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/261598"&gt;@quentin_young&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use this link for&amp;nbsp;Splunk Web Framework Component Reference.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/DocumentationStatic/WebFramework/1.0/" target="_blank"&gt;https://docs.splunk.com/DocumentationStatic/WebFramework/1.0/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;JQuery:&amp;nbsp;&lt;A href="https://www.w3schools.com/jquery/default.asp" target="_blank"&gt;https://www.w3schools.com/jquery/default.asp&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Splunk UI Toolkit:&amp;nbsp;&lt;A href="https://splunkui.splunk.com/home" target="_blank"&gt;https://splunkui.splunk.com/home&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Integrating jQuery DataTables Into Splunk:&lt;/P&gt;&lt;P&gt;&lt;A href="https://hurricanelabs.com/splunk-tutorials/integrating-jquery-datatables-into-splunk-tutorial-part-1/" target="_blank"&gt;https://hurricanelabs.com/splunk-tutorials/integrating-jquery-datatables-into-splunk-tutorial-part-1/&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and so on.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Happy Learning&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if you face any issues, just let us know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;If any of my replies help you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 05:41:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/How-to-use-the-JavaScript-to-send-requests-to-Splunk-and-have/m-p/670929#M18024</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2023-12-06T05:41:37Z</dc:date>
    </item>
  </channel>
</rss>

