Content Idea Generator

Content Idea Generator

document.getElementById('keywordResearchForm').addEventListener('submit', (e) => { e.preventDefault(); const keyword = document.getElementById('keyword').value; getKeywordResults(keyword); }); async function getKeywordResults(keyword) { const apiURL = `https://suggestqueries.google.com/complete/search?client=firefox&q=${encodeURIComponent(keyword)}`; try { const response = await fetch(apiURL); const data = await response.json(); displayKeywordResults(data[1]); } catch (error) { console.error('Error fetching keyword results:', error); } } function displayKeywordResults(data) { const resultsDiv = document.getElementById('keywordResults'); resultsDiv.innerHTML = ''; data.forEach((result) => { const resultElement = document.createElement('div'); resultElement.className = 'result'; resultElement.innerHTML = `

${result}

`; resultsDiv.appendChild(resultElement); }); }
Scroll to Top