Conversation
| function reserveSpot(){ | ||
| var _name = $("#inputName").val(); | ||
| var _email = $("#inputEmail").val(); | ||
| urlDynamic = urlDynamic+"/reservations"; |
There was a problem hiding this comment.
This tacks on reservations, so each time you try to reserve a spot, the URL gets longer.
ie URL on first click= https://trektravel.herokuapp.com/trips/##/reservations/
on second= https://trektravel.herokuapp.com/trips/##/reservations/
| <small | ||
| id="emailHelp" | ||
| class="form-text text-muted" | ||
| >We'll never share your email with anyone |
| .append($("<button>") | ||
| .addClass("btn btn-default viewDetail") | ||
| .data("idTrip",item.id) | ||
| .append("Trip "+item.id + " " +item.name) |
There was a problem hiding this comment.
The formatting here is kind of wonky
| @@ -0,0 +1,90 @@ | |||
| const URL_ALL_TRIPS = "https://trektravel.herokuapp.com/trips" | |||
| var urlDynamic = URL_ALL_TRIPS; //so its easier to modify for different calls | |||
There was a problem hiding this comment.
You're putting the current trip ID in this global scope in order to store what the current trip is... You should consider different approaches to get the value of the current trip id. Could you use a closure or read from the HTML with event delegation?
Also, we use let, not var!
| alert("Your reservation was successful!!."); | ||
| } | ||
| }).catch(function(error){ | ||
| alert("Sorry an error ocurred, please try again."); |
There was a problem hiding this comment.
These error messages don't tell us anything about what is going wrong with this request. You're not making an effort to describe in detail what the user needs to do to continue properly.
TREKWhat We're Looking For
|
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.