我试图使用jquery追加数据,但它只显示状态消息但不显示按钮!虽然按钮显示在萤火虫上?
$("form.follow-form").live('submit', function(e) { /* stop event */
e.preventDefault(); /* "on request" */
$(this).find('i').addClass('active'); /* send ajax request */
$.ajax({
type: "POST",
url: "ajax_more.php",
data: $(this).serialize(),
cache: false,
success: function(html) {
$("ul.statuses").append(html);
$("form.follow-form").remove();
// this is not full code ;)
这是ajax_more.php文件:
$query= mysql_query($result) or die(mysql_error().$result);
while($row=mysql_fetch_array($query))
{
$dateTime = $row['dt'];
//the append shows this
echo formatUpdate($row['user_note'],$row['dt']);
}
?>
// but not this form, it deos show on firebug only
<form class="follow-form" method="post" action="ajax_more.php">
<input name="date" value="<?php echo $dateTime ?>" type="hidden">
<button type="submit" value="Actions" class="btn follow" title="123456">
<i></i><span>More</span>
</button>
</form>
答案 0 :(得分:0)
ajax调用成功后,您将删除表单:
$("form.follow-form").remove();
尝试评论此行并运行代码,看看是否显示该表单。
//$("form.follow-form").remove();