Well in the tutorial it makes the information in the JSON file into html format and I can see it on the screen. But after I change the source to this http://quotes.stormconsultancy.co.uk/quotes.json nothing happens, like it couldn’t read it or something
´´´
$.getJSON(“http://quotes.stormconsultancy.co.uk/quotes.json”, function(json) {
var luku = Math.floor((Math.random() * 44) + 1);
json = json.filter(function(val) {
return (val.id == luku);
});
var html = json.quote + " - " + json.author;
´´´
but the last line does not work it comes out “undefined - undefined”. But I know for a fact that those same json.xxx work on the pen that using as an example.
I’m not entirely sure what character that is lol. On windows the back tick key is top left above the tab next to 1, on mac its right of the left shift and next to z.
Also, my mistake, I got confused with the closing brackets from the filter function
The reason it’s undefined is because json is an array, so you’ll probably want to do something like:
var html = json[0].quote + " - " + json[0].author;