Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jan Edrozo | Carets #33

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open

Jan Edrozo | Carets #33

wants to merge 30 commits into from

Conversation

JNEdrozo
Copy link

@JNEdrozo JNEdrozo commented Nov 27, 2017

TREK

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What does it mean for code to be asynchronous? Asynchronous code will be executed at some point in the future, often in response to some external event. Asynchronous code is a means of parallel programming in which a unit of work runs separately from the main application thread and notifies the calling thread of its completion, failure or progress.
Describe a piece of your code that executes asynchronously. How did this affect the way you structured it? For my event listener (To View Trip Details), the #featured-content html info loads, while the event listener waits for the html document to be loaded and ready. This affects how I structured my event listener code, because originally in my global ($) function, I only targeted #trip-details, when really I needed to first select #featured-content, which is where #trip-details is created after the html document loads.
What kind of errors might the API give you? How did you choose to handle them? If the requested URL is invalid, I may get back API errors. In the event that the callback is not successful, I've printed to the console log and used .html to replace success content with a failure message for the user to read.
Do you have any recommendations on how we could improve this project for the next cohort? More guided lectures on how to use the lastest version of foundation with javascript, please!

@tildeee
Copy link

tildeee commented Dec 1, 2017

TREK

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene x
Comprehension questions x
Functionality
Click a button to list trips x
Click a trip to see trip details x
Fill out a form to reserve a spot
Errors are reported to the user x
Styling, Foundation grid layout x
Under the Hood
Trip data is retrieved using jQuery AJAX x
JavaScript is well-organized and easy to read x
HTML is semantic x
Overall

The styles look great :)

Submitting your reservation form isn't making a POST request for me. The code is also breaking about a reference to event. I've added a comment about it!

Overall, good job with the project-- Let's talk about what happened with the reservation form submission!

index.js Outdated
// To Reserve Trip
$('#single-trip-info').on('submit', '#reservation', function(response) {
console.log('Button reserve trip clicked');
event.preventDefault();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right-- the callback that you pass in as the third parameter to .on(...) should be a function that takes in one parameter. In this case, you name it response, but it does represent the event object that describes the event that triggered this handler.

On this line, (line 169) you call event.preventDefault();. However, event is not defined within this scope, so the JS breaks at this point.

If you rename response to event, the app works as expected.

…d adding additional bottom and padding and margin in #reservation-modal section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants