jquery的提交评论!

[不指定 2008/11/11 16:15 | by 折雨 ]
| |

function updatecom()
{
  //提交评论
  $("#msg").addClass("msg");
  
  $.ajax({
    beforeSend:function(){$("#msg").html("正在发送数据");},
    type: "POST",
    //timeout:2000,
    url: "xhttp.php",
    data:$("input[@type=text]").serialize()+"&content="+$("#content").val()+"&rubyid="+$("#rubyid").val()+"&readycom="+$("#readycom"),
    success: function(getstr){
    changeimg();
    if(getstr=="code_error"){
      $("#msg").html("验证码错了");
    }else if(getstr=="cnull"){
      $("#msg").html("评论的内容为空");
    }else{
      $("#msg").html("你的评论提交成功,刷新后显示");
      $("#recom").append("<div class =cls7>您添加的评论:<br />"+$("#content").text().replace("<","&lt;")+"</div>");
      document.getElementById("comments").reset();
    }
    },
    error:function(){("#msg").html("发生错误");}
    
  })
    
}

</script>

学习时间 | 评论(0) | 引用(0) | 阅读(43)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]