首页 > 请问下这段代码的form提交为什么没有数据

请问下这段代码的form提交为什么没有数据

<form action="<?php echo base_url('question/addQuestionComment');?>" method="post" id="question-comment-form">
<input type="hidden" id="id" value="<?php echo $question['question_id'];?>">
<div style="display:none" id="question-comment-content">
    <textarea rows="2" cols="50" class="question-comment-editor" id="comment_content"></textarea>
</div>
<div style="display:none" id="question-comment-submit">
    <input type="submit" class="btn btn-sucesss" value="提交评论" id="post-question-comment">
</div>

我用$('#question-comment-form').serialize()提交表单数据,但是发现这种方法post的数据是空的,请问下这是怎么回事?


For a form element's value to be included in the serialized string, the element must have a name attribute.

http://jqapi.com/#p=serialize

不懂表单的人们啊,id、class 写那么多却不写 name 折磨用户呢……(火狐不能识别并记住没有名字的登录表单的登录信息)

【热门文章】
【热门文章】