@quentin_young Sharing my sample code. please check the console for results. test_js_action.js require([
'underscore',
'jquery',
'splunkjs/mvc',
"splunkjs/mvc/searchmanager",
...
See more...
@quentin_young Sharing my sample code. please check the console for results. test_js_action.js 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();
});
});
}); XML <dashboard version="1.1" script="test_js_action.js">
<label>test_js_action</label>
<row>
<panel>
<html>
<div>
<button id="btn_submit">submit</button>
</div>
</html>
</panel>
</row>
</dashboard> I hope this will help you. Thanks KV If any of my replies help you to solve the problem Or gain knowledge, an upvote would be appreciated.