-
Notifications
You must be signed in to change notification settings - Fork 0
/
DemoFormCreation.html
95 lines (86 loc) · 2.39 KB
/
DemoFormCreation.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
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="Demostylesheet.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">
</script>
<script>
function appendPost()
{
var listing = {
'from_loc': $('#from_loc').val(),
'to_loc': $('#to_loc').val(),
'description': $('#description').val(),
'date': $('#date').val(),
'num_riders': $('#num_riders').val(),
'type': $('#type').val()
};
$.ajax({
type: "POST",
url: 'http://localhost:8080/addpost',
contentType: "application/json; charset=utf-8",
data: JSON.stringify(listing),
dataType: 'text',
success: function(msg) {
alert("Listing added!");
},
error: function(jgXHR, textStatus, errorThrown) {
console.log(errorThrown);
alert("Error: " + textStatus + " " + errorThrown);
}
});
}
</script>
</head>
<body>
<header>
<div class="container">
<a href="DemoMainPage.html">
<img class="logo" src="DragonPoolLogo.png">
</a>
<nav>
<ul>
<!-- Mian links to other pages -->
<li><a href="DemoDisplayAccount.html">ACCOUNT</a></li>
<li><a href="DemoCreateAccount.html">Sign IN</a></li>
<li><a href="DemoFormCreation.html">CREATE LISTING</a></li>
<li><a href="DemoListPage.html">SEARCH LISTING</a></li>
<li><a href="DemoContactPage.html">CONTACT</a></li>
</ul>
</nav>
</div>
</header>
<div class="ListingCont">
<center>
Looking For:<br>
<select id='type'>
<option value="Looking For">Driver</option>
<option value="Providing">Passengers</option>
</select>
<br>
Date:<br>
<input type="date" id="date" placeholder="Select Date" min= "2019-01-01" max="2020-01-01" >
<br>
<br>
From:<br>
<input type="text" id="from_loc" placeholder="From">
<br>
<br>
To:<br>
<input type="text" id="to_loc" placeholder="To">
<br>
<br>
Description:<br>
<textarea id="description"> </textarea>
<br>
<br>
Number of Riders:<br>
<input type="text" id="num_riders" placeeholder="Number of Riders">
<!-- Button That Submits gathered data/could 'onclick' a function -->
<input type="submit" value="Submit" onclick="appendPost()">
<br>
</center>
</div>
</body>
</html>