I'm trying to use AJAX to gather search results from DuckDuckGo's Search API.
Here's the JavaScript I've written so far:
$.ajax({
type: 'GET',
url: 'https://api.duckduckgo.com/',
data: { q: myhomestate, format: 'json', pretty: 1 },
jsonpCallback: 'jsonp',
listLocation: "RelatedTopics",
dataType: 'text'
}).then(function (data) {
console.log(data);
});
}
The code works fine, but it just returns a big JSON object, and I don't know how to select any of its elements. Please help!