-
Notifications
You must be signed in to change notification settings - Fork 0
/
results.html
82 lines (73 loc) · 2.59 KB
/
results.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
81
82
<!DOCTYPE html>
<html>
<head>
<title>Search Results</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<link rel="stylesheet" href="https://use.typekit.net/znk3xkz.css">
</head>
<body>
<!-- header -->
<div id="overlay" onclick="off()">
<img src="images/signin.png" class="imgoverlay" width="23%">
</div>
<img src="images/menu.png" width="100%">
<p class="smallheader"><a href="etsy.html">Home</a> › <a href="results.html">Assisty Results</a></p>
<!-- header -->
<!-- content -->
<div class="results">
<h1>Results</h1>
<h2>Enjoy Assisty's picks for you</h2>
<!-- <a href="etsy2.html" class="stylebutton save">save results</a> -->
<div class="save" onclick="on()">save results</div>
<img src="images/filters.png" width="65%" class="filters">
</div>
<div class="container"></div>
<!-- content -->
<img class="resultsfooter" src="images/footer.png" width="100%">
<script>
function on() {
document.getElementById("overlay").style.display = "block";
}
function off() {
document.getElementById("overlay").style.display = "none";
}
styles = sessionStorage.party1+","+sessionStorage.party2;
console.log(styles)
othertags = sessionStorage.colors+","+sessionStorage.len+","+sessionStorage.len+","+sessionStorage.len+","+sessionStorage.showoff+","+sessionStorage.fit;
console.log(othertags)
var data = {
"size":12,
"query": {
"bool": {
"must": [
{ "match": { "othertags": othertags } },
{ "match": { "occastion": sessionStorage.occasion } },
{ "match": { "primaryStyleTag": styles } }
]
}
}
};
console.log(data);
$.ajax({
type: 'POST',
url: 'https://27f1a4ae3af241cc8b2c427aefc81cc9.us-east-1.aws.found.io:9243/assisty/_search?pretty=true',
data: JSON.stringify(data),
dataType : 'json',
contentType: 'application/json',
headers: {
"Authorization": "Basic " + btoa('elastic' + ":" + 'gPIFNnQB7kw4cWG6Xh5c0H8I')
},
success: function (data) {
$.each( data.hits.hits, function( index, value ) {
console.log(value._source);
var shorterName = jQuery.trim(value._source.name).substring(0, 22)+ "...";
$(".container").append("<a class='prod' href=" + value._source.itemurl + ">" + "<img class='prodimg' src=" + value._source.imageUrl + "><p class='prodname'>" + shorterName + "</p><p class='seller'>" + value._source.sellerName + "</p><p class='price'>$" + value._source.price + "</p></a>");
});
}
});
sessionStorage.clear();
</script>
</body>
</html>