你好,我在我的应用程序中有多个具有相同结构的元素。第二个div元素的id根据数据库中唯一的评论id而变化。有id为“vote_up”和“vote_down”的元素。这会针对每个评论重复出现。由于有多个评论,发生的情况是我想执行一个Ajax请求。这个结构的第一个函数使用ajax正常工作,但其余部分使用http请求。顺便说一下,我正在开发一个Rails应用程序,并使用jQuery。
<div id="post_comment">
john<i> says </i> Comment<br/>
<div id="comment_10_div">
**<form action="/comments/vote_up" id="vote_up" method="post">**
<div style="margin:0;padding:0;display:inline">
<input name="authenticity_token" type="hidden"
value="w873BgYHLxQmadUalzMRUC+1ql4AtP3U7f78dT8x9ho=" />
</div>
<input id="Comment_place_id" name="Comment[post_id]" type="hidden" value="3" />
<input id="Comment_id" name="Comment[id]" type="hidden" value="10" />
<input id="Comment_user_id" name="Comment[user_id]" type="hidden" value="2" />
<input name="commit" type="submit" value="Vote up" />
</form>
<label id="comment_10">10</label>
**<form action="/comments/vote_down" id="vote_down" method="post">**
<div style="margin:0;padding:0;display:inline">
<input name="authenticity_token" type="hidden"
value="w873BgYHLxQmadUalzMRUC+1ql4AtP3U7f78dT8x9ho=" />
</div>
<input id="Comment_place_id" name="Comment[place_id]" type="hidden" value="3" />
<input id="Comment_id" name="Comment[id]" type="hidden" value="10" />
<input id="Comment_user_id" name="Comment[user_id]" type="hidden" value="2" />
<input name="commit" type="submit" value="Vote Down" />
</form>
</div>
你能帮我解决这个问题吗?谢谢。