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 Updating Entries in a Table

Anoop Mundathan
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Anoop Mundathan
Full Stack JavaScript Techdegree Graduate 15,674 Points

Why Query String ?method='PUT' is used instead of method='PUT'?

I can see in edit.jade file below line

`form(action="/articles/" + article.id + "?_method=PUT", method="post")

Why method=post is used rather than method="put"?. Why query string is used in this case? .

1 Answer

Balázs Földesi
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Balázs Földesi
Full Stack JavaScript Techdegree Graduate 16,750 Points

The only valid values here for the method attribute are 'get' or 'post'. On the query string it's specified that it's a put request. With the method-override (https://www.npmjs.com/package/method-override) npm package you can handle that request this way.

Is this explained somewhere in one of the videos?