【发布时间】:2011-01-17 21:22:09
【问题描述】:
我在一个页面上通过循环列出了几个表单,如下所示:(摘录)
if(mysql_num_rows($r)>0):
while($row = mysql_fetch_assoc($r)): ?>
<form id="myForm" action="save_fb.php" method="post">
Title: <input type="text" name="fb_title" value="<?php echo $row['fb_title']; ?>" /><br>
<a href="javascript:;" class="save_fb" id="<?php echo $row['fb_id']; ?>"></a>
</form>
在我的 ajax 请求中,我执行以下操作:
$.ajax({
type: "POST",
data: $("input:text[name=fb_titel]").val()+$(this).attr("id"),
url: "save_fb.php",
success: function(msg)
{
$("span#votes_count"+the_id).fadeOut();
$("span#votes_count"+the_id).html(msg);
$("span#votes_count"+the_id).fadeIn();
}
});
});
现在我得到的结果总是第一行而不是单击链接的行但是 $(this) 工作正常但我不知道如何组合...有人知道数据线应该是什么样子吗?
感谢任何提示 =)
【问题讨论】:
标签: jquery ajax forms jquery-selectors