hussein2000 commited on
Commit
58835c8
·
verified ·
1 Parent(s): e123b3f

Create index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +36 -0
templates/index.html ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>DuckDuckGo Search</title>
7
+ <script>
8
+ async function performSearch() {
9
+ const query = document.getElementById('search-query').value;
10
+ const response = await fetch(`/search?query=${encodeURIComponent(query)}`);
11
+ const results = await response.json();
12
+
13
+ const resultsContainer = document.getElementById('results');
14
+ resultsContainer.innerHTML = ''; // Clear previous results
15
+
16
+ results.forEach(result => {
17
+ const resultItem = document.createElement('div');
18
+ resultItem.innerHTML = `
19
+ <h3><a href="${result.link}" target="_blank">${result.title}</a></h3>
20
+ <p>${result.description}</p>
21
+ <img src="${result.icon}" alt="Icon" style="width: 16px; height: 16px;">
22
+ <hr>
23
+ `;
24
+ resultsContainer.appendChild(resultItem);
25
+ });
26
+ }
27
+ </script>
28
+ </head>
29
+ <body>
30
+ <h1>DuckDuckGo Search</h1>
31
+ <input type="text" id="search-query" placeholder="Enter search query">
32
+ <button onclick="performSearch()">Search</button>
33
+
34
+ <div id="results"></div>
35
+ </body>
36
+ </html>