Dashboards & Visualizations

JS button to create a new dashboard

oO0NeoN0Oo
Loves-to-Learn Lots

Hi all,

First post in SPLUNK and I'm not even going to pretend I know the in's and out's of everything that I am currently trying to achieve so I apologise if this is an easy answer...

I have created a dashboard that contains an HTML form and through JS magic it does everything I need it to, which includes a 'submit' button that is connected to an HTML table in a different panel. When the button is clicked the table is updated with the relevant information - Happy days. Under the HTML table, I have another button that when clicked I want it to create a new dashboard that displays that table (there is more to it but for now I just need it to create a new dashboard). 

After a bit of research, I stumbled across AJAX but I'm constantly receiving a 404 error. I understand that a 404 is resource not found, but every document I find indicates that this is the correct resource. My SPLUNK Enterprise version is currently running on my Laptop (127.0.0.1:8000) but I am at a frustrating loss now...

 

 

document.getElementById('confirmButton').addEventListener('click', function() {
    var dashboardData = {
        name: 'newDash',
        'eai:data': '<dashboard><label>$name$</label><description>$goal$</description><row><panel><html><h1>something</h1></html></panel></row></dashboard>',
    };
    $.ajax({
        url: '/serviceNS/nobody/search/data/ui/views',
        type: 'POST',
        data: dashboardData,
        success: function(response) {
            console.log('Success:', response);
        },
        error: function(jqXHR, textStatus, errorThrown) {
            console.error('Error:', textStatus, errorThrown);
        }
    });
});

 

 


The issue seems to indicate the url section is wrong, but if anyone could help point me in the right direction, I would greatly appreciate it.

Kind Regards,
oO0NeoN0Oo
  

Labels (2)
0 Karma
Get Updates on the Splunk Community!

Index This | What did the zero say to the eight?

June 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

Splunk Observability Cloud's AI Assistant in Action Series: Onboarding New Hires & ...

This is the fifth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Now Playing: Splunk Education Summer Learning Premieres

It’s premiere season, and Splunk Education is rolling out new releases you won’t want to miss. Whether you’re ...