forked from kathdovi/meet-me-halfway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew-trip.js
65 lines (46 loc) · 1.46 KB
/
new-trip.js
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
console.log('new trip js')
let trip;
//TO DO ADD HIDE BUTTON//
$("#save1").on("click", function (event) {
event.preventDefault();
let userID = localStorage.getItem('userID');
friend1City = $("#city1").val().trim();
friend2City = $("#city2").val().trim();
dest1 = $("#display-city-1").text();
cost1 = $("#city-1-price").text();
trip = database.ref(`users/${userID}/trips`).push({
location: dest1,
money: cost1,
person1: friend1City,
person2: friend2City,
})
});
$("#save2").on("click", function (event) {
event.preventDefault();
let userID = localStorage.getItem('userID');
friend1City = $("#city1").val().trim();
friend2City = $("#city2").val().trim();
dest2 = $("#display-city-2").text();
cost2 = $("#city-2-price").text();
trip = database.ref(`users/${userID}/trips`).push({
location: dest2,
money: cost2,
person1: friend1City,
person2: friend2City,
})
});
$("#save3").on("click", function (event) {
event.preventDefault();
let userID = localStorage.getItem('userID');
friend1City = $("#city1").val().trim();
friend2City = $("#city2").val().trim();
let dest3 = $("#display-city-3").text();
let cost3 = $("#city-3-price").text();
console.log(dest3);
trip = database.ref(`users/${userID}/trips`).push({
location: dest3,
money: cost3,
person1: friend1City,
person2: friend2City,
})
});