Skip to content

Commit caf624f

Browse files
committed
create new branch for website
1 parent d9df8fc commit caf624f

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

index.html

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>Sentiment Analysis Web App</title>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
8+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
9+
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
10+
11+
<script>
12+
"use strict";
13+
function submitForm(oFormElement) {
14+
var xhr = new XMLHttpRequest();
15+
xhr.onload = function() {
16+
var result = parseFloat(xhr.responseText);
17+
var resultElement = document.getElementById('result');
18+
if (result == 0) {
19+
resultElement.className = 'bg-danger';
20+
resultElement.innerHTML = 'Your review was NEGATIVE!';
21+
} else {
22+
resultElement.className = 'bg-success';
23+
resultElement.innerHTML = 'Your review was POSITIVE!';
24+
}
25+
}
26+
xhr.open (oFormElement.method, oFormElement.action, true);
27+
var review = document.getElementById('review');
28+
xhr.send (review.value);
29+
return false;
30+
}
31+
</script>
32+
33+
</head>
34+
<body>
35+
36+
<div class="container">
37+
<h1>Is your review positive, or negative?</h1>
38+
<p>Enter your review below and click submit to find out...</p>
39+
<form method="POST"
40+
action="https://lx9twcx6ni.execute-api.ap-northeast-1.amazonaws.com/prod"
41+
onsubmit="return submitForm(this);" > <!-- HERE IS WHERE YOU NEED TO ENTER THE API URL -->
42+
<div class="form-group">
43+
<label for="review">Review:</label>
44+
<textarea class="form-control" rows="5" id="review">Please write your review here.</textarea>
45+
</div>
46+
<button type="submit" class="btn btn-default">Submit</button>
47+
</form>
48+
<h1 class="bg-success" id="result"></h1>
49+
</div>
50+
</body>
51+
</html>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy