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

pipes | tanisha | trek #37

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

pipes | tanisha | trek #37

wants to merge 30 commits into from

Conversation

tanham
Copy link

@tanham tanham 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 means that your webpage will load and can be interacted with while it waits for a request or response.
Describe a piece of your code that executes asynchronously. How did this affect the way you structured it? I have a loadTrips() function that only executes when a button is click. I define that function the beginning of my code and then invoke the function within a click event later on in the code
What kind of errors might the API give you? How did you choose to handle them? during development, I got a 501 error within the post request. I handled it by console logging the each parameter that was passed into the post request and found that the url was coming back as undefined.
Do you have any recommendations on how we could improve this project for the next cohort? no

@droberts-sea
Copy link

TREK

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene yes
Comprehension questions yes - Regarding asynchronous code, anything that runs at some unspecified time in the future is asynchronous, including everything from AJAX success / failure callbacks to button click handlers.
Functionality
Click a button to list trips yes
Click a trip to see trip details yes
Fill out a form to reserve a spot yes
Errors are reported to the user yes
Styling, Foundation grid layout yes
Under the Hood
Trip data is retrieved using jQuery AJAX yes
JavaScript is well-organized and easy to read mostly - see inline
HTML is semantic yes
Overall

Great job overall! In my estimation there are two difficult things in JavaScript we've never had to do in Ruby/Rails:

  • Working with callback functions, especially in an asynchronous context
  • Manipulating the DOM (and structuring the DOM to make it easy to manipulate)

Based on this submission I'd say you have a good handle on both. These topics will get substantially more complex as we continue to build bigger apps with more moving parts, so keep up the focus and hard work!

}) // end .fail
.always(function(){
console.log('always even if we have success or failure');
});

Choose a reason for hiding this comment

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

You probably don't need these always callbacks. I think of an always much like the ensure clause on Ruby's begin/rescue blocks: useful every once in a very long while, and otherwise safe to omit.

const loadTrip = function loadTrip(id) {
$.get(`https://trektravel.herokuapp.com/trips/${id}`,
response => {
let tripInfo = `

Choose a reason for hiding this comment

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

This callback ends up being quite long. It would probably be worthwhile to break some of the components out into separate named functions defined at the top of the file.

// EVENTS
$('ul').on('click', 'p', function(){
const tripID = $(this).attr('data-id');
loadTrip(tripID);

Choose a reason for hiding this comment

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

I like that you define your handlers above and then register everything all in one place - good organization.

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