forked from SHIKHER09/Future-Door
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearchpage.html
80 lines (65 loc) · 2.24 KB
/
Searchpage.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample project</title>
<link rel="stylesheet" href="main.css">
</head>
<body >
<div class="container">
<div class="text">
<div class="whole">
<div class="search">
<h3>Search </h3>
</div>
<div class="para">
<p style="text-align: center;">Search all your queries related to any research field,<br> any research article
here.</p>
</div>
<input type="text" id='city' name="box" placeholder="Search here...">
<input type="submit" onclick="get()" id='sub' name="" value="Search">
<div id="cards">
</div>
</div>
</div>
<div class="image">
<img src="img2.0-removebg-preview.png" alt="image">
</div>
</div>
<!--------------------------------------------javascript------------------------------------------>
<script>
var button = document.getElementById('#sub');
var input1 = document.getElementById('city');
function get() {
var apikey = 'a14ec5b259e323552ed01edf0f2b317832184c44cb2b7e5c06a8bcc76d062351';
var sum = input1.value + "&api_key=" + apikey;
fetch('https://serpapi.com/search.json?engine=google_scholar&q=' + sum)
.then((apidata) => {
return apidata.json();
})
.then((actualdata) => {
let data1 = "";
actualdata.organic_results.map((values) => {
data1 += `<div class="card" >
<div class="card-header" >
<a href="${values.link}">${values.title}</a>
</div>
<div class="card-body" >
<blockquote class="blockquote mb-0">
<p>${values.snippet}</p>
<footer class="blockquote-footer"> <cite title="Source Title">${values.publication_info.summary}</cite></footer>
</blockquote>
</div>
</div>`
});
document.getElementById('cards').innerHTML = data1;
})
.catch((error) => {
console.log(error);
})
}
</script>
</body>
</html>