-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
46 lines (39 loc) · 1.23 KB
/
index.html
File metadata and controls
46 lines (39 loc) · 1.23 KB
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
<!doctype HTML>
<html>
<head>
<title>Example</title>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/smoothness/jquery-ui.min.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js"></script>
</head>
<body>
<div id="result"> </div><br>
<form id=example method='GET'>
Date: <input type='text' id='date' name='date'><br>
<input id=lookup type=submit value="Lookup"><br>
</form>
<script>
$("#example").submit(function(event) {
event.preventDefault();
var $form = $(this);
var query = $('#date').val();
var get = $.ajax({
url: "https://gm9k8wsank.execute-api.us-west-2.amazonaws.com/prod1" + "/date/" + query,
type: "GET"
});
get.done(function(data) {
$("#result").css("color", "blue");
if((data.length) > 0) {
$("#result").empty().html(data[0].DCOILWTICO);
} else {
$("#result").empty().html("NOT FOUND");
}
});
get.fail(function(data) {
$("#result").css("color", "red");
$("#result").empty().html("API call failed");
});
});
</script>
</body>
</html>