Getting Data In

How to work with JSON file from JS?

rendie
Path Finder

Hi,
I have to write some information to JSON file because of this method comfortable for me, but when I am trying read JSON file from JS file I have an error with 404 code.
How to fix it? How work with JSON file from JS file in /appserver/static?
Thanks.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@rendie

Can you please share your sample javascript code for JSON file read/write opearation??

0 Karma

rendie
Path Finder

@kamlesh_vaghela

require([
"splunkjs/mvc", "jquery",
'splunk.util', 'splunkjs/mvc/tableview',
'splunkjs/mvc/searchmanager',
'splunkjs/mvc/simplexml/ready!' ], function(mvc, $, splunkUtil,
TableView ) { var request = new
XMLHttpRequest(); request.open('GET',
'saved.json', true); request.send();
console.log(request.statusText); });

JSON and JS in one folder, is /appserver/static

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...