I have a local json file
[{"image": "//www.dw.com/image/0,,18610867_301,00.jpg",
"link": "//www.dw.com/en/alcoa-splitting-up-amid-commodity-slump/a-18746568",
"heading": "Alcoa splitting up amid commodity slump"},
{"image": "//www.dw.com/image/0,,18742245_301,00.jpg",
"link": "//www.dw.com/en/kenya-ghetto-classics/a-18742091",
"heading": "Kenya Ghetto Classics"},
{"image": "//www.dw.com/image/0,,18045608_301,00.jpg",
"link": "//www.dw.com/en/rajoy-seeks-talks-after-catalonia-election-win/a-18746178",
"heading": "Rajoy seeks talks after Catalonia election win"},
{"image": "//www.dw.com/image/0,,18746472_301,00.jpg",
"link": "//www.dw.com/en/saudi-led-coalition-strikes-wedding-party-in-yemen-killing-scores-of-civilians/a-18746445",
"heading": "Saudi-led coalition strikes wedding party in Yemen, killing scores of civilians"}]
Now I want to read it from another javascript file and present the information in a nice table. For the table visuliztaion I want to use keen.io but problem is that I cannot read the json file and return it literally that is I do not need to change the data I just need to read the data and plug it in keen.io
I have been trying the following code
$(document).ready(function() {
var data = $.getJSON('data/web_stories.json', function(data) {
dataStories = data
});
Keen.ready(function(){
var multipleEvents = {
"stories": data
}
// Send multiple events to several collections
client.addEvents(multipleEvents, function(err, res){
if (err) {
console.log('there is an error!')
}
else {
console.log('data sent')
}
});
But it doesn’t seem go work I get the following error: 400 (Bad Request)