Wiki Viewer Project Help!

Having trouble accessing the parameters of the JSON for WikiViewer.

 $.getJSON(api, function(data) {
            console.log(data);
            var results = data.query.search[1];
            console.log(results);
            $('#searchResults').text(results);
        });

i keep getting this error

Uncaught TypeError: Cannot read property ‘search’ of undefined
at Object.success (main.js:30)
at u (jquery-3.3.1.min.js:2)
at Object.fireWith [as resolveWith] (jquery-3.3.1.min.js:2)
at k (jquery-3.3.1.min.js:2)
at HTMLScriptElement.n (jquery-3.3.1.min.js:2)
at HTMLScriptElement.dispatch (jquery-3.3.1.min.js:2)
at HTMLScriptElement.y.handle (jquery-3.3.1.min.js:2)

It may be from the fact that data.query does not have a property search[1].
Can you share the codepen link to see exactly what you get into the console when you console.log(data)?

The error says “Uncaught TypeError: Cannot read property ‘search’ of undefined”. probably there is no property called search. check console.log for data to confirm the properties to tap on.

thank you but i solved it, instead of trying to search for the JSON parameters I’m just using the arrays themselves to display the data.