带有没有JavaScript的链接的POST [英] POST with links without JavaScript

查看:122
本文介绍了带有没有JavaScript的链接的POST的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在我的页面上有一个日历,并且点击一天将标记为完整。
但我想使用POST而不是GET,因为GET不适合这种东西(改变某些东西)。我也不想使用JavaScript。



我在这里要做的是构建一个没有JavaScript的页面(我将用它来升级用户界面,以便通过XHR完成此更新),但我还想遵守HTTP的使用方式(如果我正确理解REST,这就是REST的意思)。



那么有没有办法做到这一点,或者是从一开始就使用链接来改变数据的错误方法?如果是这样,唯一可行的解​​决方案(对于我的具体问题),我可以看到每天使用提交按钮(以及每天的表单)。但我对这里的一般想法更感兴趣,不仅仅是针对我的问题。

解决方案


有没有办法做到这一点,或

不,没有。


正在使用链接从一开始就改变数据的错误方法?

是的,它是的。



...虽然您可以将CSS应用于按钮。


Let's say I have a calendar on my page and clicking on a day would mark that day as complete. But I want to use POST and not GET, since GET is not suitable for this kind of stuff (changing something). And I also don't want to use JavaScript.

What I'm going for here is to build a page that will work without JavaScript (which I will use to "upgrade" the UI so that this updating is done via XHR) but I would also like to comply with how HTTP is meant to be used (this is what REST is about if I understand REST correctly).

So is there any way to do this, or is using links to change data the wrong approach from the start? If it is, the only viable solution (for my concrete problem) I can see is to use submit buttons for every day (along with a form for every day). But I'm more interested in the general idea here not just for my problem.

解决方案

So is there any way to do this, or

No, there isn't.

is using links to change data the wrong approach from the start?

Yes, it is.

… although you could apply CSS to buttons.

这篇关于带有没有JavaScript的链接的POST的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆