How can I get form data with JavaScript/jQuery?

前端 未结 28 2329
不知归路
不知归路 2020-11-22 12:39

Is there a simple, one-line way to get the data of a form as it would be if it was to be submitted in the classic HTML-only way?

For example:



        
28条回答
  •  清歌不尽
    2020-11-22 13:25

    If you are using jQuery, here is a little function that will do what you are looking for.

    First, add an ID to your form (unless it is the only form on the page, then you can just use 'form' as the dom query)

    提交评论

提交回复
热议问题