Why use a form tag when you're submitting via ajax?

前端 未结 7 916
你的背包
你的背包 2020-12-04 20:59

Philosophical question:

Say I\'ve got a web app that requires javascript and a modern browser, so progressive enhancement is not an issue. If my form is be

7条回答
  •  天命终不由人
    2020-12-04 21:13

    I don't see why you would need to use the form tag here. The only reason to use a form tag (other than to get your markup to validate) is if you are going to have the user "submit" the data using a sumbit input or button tag. If you don't need to do that, then there is no need for the form. However, not sure if it will be considered "valid" markup. If you do use it you can just do

    as action is the only required attribute of the form tag. However, you do bring up a good point, the future of web applications probably will no longer need the form and traditional submit methodology. Very interesting, and makes me happy. hehe :)

提交回复
热议问题