Italian Menus
document.getElementById("Italian Menus").addEventListener("submit", function(event) {
event.preventDefault();
var query = document.getElementById("query").value;
// 3. Perform an HTTP request to a search engine API
fetch("https://cse.expertrec.com/api/js/ci_common.js?id="+ query)
.then(function(response) {
return response.json();
})
.then(function(data) {
// 4. Parse the API response and extract the search results
var results = data.results;
// 5. Create a new HTML page with the search results
var html = "Search Results
Search Results
";
for (var i = 0; i < results.length; i++) {
html += "
" + results[i].title + "
";
}
html += "
";
// 6. Add functionality to print, download, share, or post the new HTML page
var newWindow = window.open("");
newWindow.document.write(html);
});
});