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 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.