Support clicking a link, but sending a POST (vs GET) to the server, without Ajax?

Posted by xyld on Stack Overflow See other posts from Stack Overflow or by xyld
Published on 2010-05-07T22:10:00Z Indexed on 2010/05/07 22:58 UTC
Read the original article Hit count: 223

I'm thinking this isn't exactly possible, but maybe I'm wrong. I'm simply torn between those who believe that only POST requests should modify data on the server and people that relax the rule and allow GET requests to modify data.

Take this situation. Say you have a table, each row is a row in the database. I'd like to allow them to delete the row via a fancy "X" icon as the very last <td></td> element in the row. AFAIK, the only way to send a POST to the server is via a form. But do I really stuff an entire form into the last <td></td> element just to do a POST? Or should I cheat and use an <a href=...></a> tag that sends a GET request?

You may be thinking "Do both! Send a POST AND use the <a ...></a> tag! Use fancy javascript + xhr!" And I'll say, oh? And how will that degrade in a zero javascript environment?

Maybe we've reached a point when it doesn't make sense to worry about gracefully degrading? I'm not sure. You tell me? I'm new to web development, but I understand most of the concepts involved.

© Stack Overflow or respective owner

Related posts about http-post

Related posts about http-get