forked from Norbaeocystin/norbaeocystin.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfeedback.html
39 lines (38 loc) · 950 Bytes
/
feedback.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
<!DOCTYPE html>
<html>
<body>
<style>
body {
background-color: #ddd;
}
div {
text-align: center;
}
</style>
<div>
<p>Please input Ebay search:</p>
<input id="search">
<button type="button" onclick="api()">Submit</button>
</div>
<script>
function api() {
var search = document.getElementById('search').value.replace(/&_/g,"***"); //problem with &_ needs to be replaced
console.log(search);
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var json = JSON.parse(this.responseText);
var data = json.data;
let csvContent = "data:text/csv;charset=utf-8,";
console.log(data)
csvContent += data;
var encodedUri = encodeURI(csvContent);
window.open(encodedUri);
}
};
xhttp.open("GET", "https://baralaboratory.com/api/v1/crambax?search=" + search, true)
xhttp.send();
}
</script>
</body>
</html>