Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript AJAX Basics (retiring) AJAX Concepts GET and POST

Do I have to capitalize GET/POST?

I've been typing GET and POST in lowercase, but when I did the code challenge, it wouldn't let me move forward with until I capitalized my "get".

Is this a style thing or a best practice?

2 Answers

http://stackoverflow.com/questions/7790576/what-are-http-method-capitalization-best-practices

Both methods (GET/POST) is based on HTTP protocol headers property name, as you know: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#open() http://www.w3.org/TR/XMLHttpRequest/#the-open()-method

So, we should use uppercase just to avoid implementation flaws in JS. And we should keep the XHTML standards too and make it lowercase in HTML forms.

It's just two different standards.

http://stackoverflow.com/questions/4106544/post-vs-post-get-vs-get

Let me get this straight--for BOTH the html form element and the xhr.open it should be in caps(ex: "GET")? But historically, you used lowercase for xhtml including form elements?

check updated answer version

Abhishek Bhardwaj
Abhishek Bhardwaj
3,316 Points

yes you have to capitalize both GET/POST.