Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript AJAX Basics (retiring) AJAX Concepts AJAX Response Formats

Question on quiz regarding ajax and using Post

Hi, I was taking the quiz and there is a question regarding when you would use POST. On one attempt I chose an answer that they said was true but that there was also another reason as well. so the next go around, I chose the other option that it could have been and was given the same error message. finally onl the third attempt I chose all the above since there was no option to select only the two correct answers and was given the error message again. Any help would be most approciated! Thanks

2 Answers

Danielle Hill
Danielle Hill
26,062 Points

Hi Erika. That question tripped me up too. Here's what I learned about the POST HTTP method with AJAX.

The POST method is definitely the best option for sending data that the web server should store in a database. It's also the method to choose for sending more than 2083 characters of data to the server. But, whether to use the POST method on a form submission depends on the type of form. Most forms that you think of, like signing up for a newsletter with a name and email or other form with personal and sensitive information being sent to the server, would use the POST method. But some forms are intended to perform a search, or to read or lookup information. The GET method is appropriate for these use cases. A great example is the Google homepage. The search bar is an input element inside a form element. That form uses the GET method.

So, the correct answer is the one that includes all options except "Everytime you submit information from a form."

Thank you so much for taking the time to answer that for me. Totally makes sense and i'm going to go and reread the question. Cheers!