Amber Lynn | Edges| Trek#35
Conversation
TREKWhat We're Looking For
Good work on this Amber Lynn. You have a lot of the code already written and built, but some of it isn't being used! The main thing I see is that: You've written a nearly perfect/working function to handle submitting and creating a reservation from the form, but you never use it! You never set up a submit event listener so that when the form has a submit event, it actually calls the Once that is hooked up, your project is most of the way there for the rest of the requirements. I've left a couple of comments elsewhere that are minor. Good work -- this project was almost all the way there to completing all of the waves! |
| tripDetail.append(`<li>About: ${response.data.about}</li>`); | ||
|
|
||
| //Automatically load Trip name in TripName input field | ||
| const input = $( "#TripName" ); |
There was a problem hiding this comment.
You don't have anything that matches the selector of #TripName ... At least, not with those uppercase letters. Watch your uppercase letters- things are usually case-sensitive in programming.
|
|
||
| $("#tripName").val(function() { | ||
| return this.value + `${response.data.name}`; | ||
| }); |
There was a problem hiding this comment.
You're passing in a function as the parameter to .val(). Does .val() take in a function? .val() just takes in whatever you want to set as the value, so usually a string.
You could probably rewrite lines 154-156 as:
$("#tripName").val(`${response.data.name}`);| $("#tripName").val(function() { | ||
| return this.value + `${response.data.name}`; | ||
| }); | ||
|
|
There was a problem hiding this comment.
Here would be a great place to add the event listener for your form to listen to the submit event and call createReservation as its callback, like so:
$('.reserve-trip').on('submit', createReservation);| // owner: $('input[name = "owner"]').val() | ||
| // } | ||
|
|
||
| axios.post(URL, reservationData) |
There was a problem hiding this comment.
Should you be posting to this URL? Check the value of the URL versus the value of the URL you want to post to in order to reserve trips as written in the documentation.
| const reservationData = readFormData(); | ||
| console.log(reservationData); | ||
|
|
||
| reportStatus('Sending pet data...'); |
There was a problem hiding this comment.
Hmmmmmm why does this say "pet"? Try not to copy-paste, try to re-type everything
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions
Tripin the list by it's ID field. Would it be advantageous to keep the list in order by the id field? Explain why or why not.