发表评论,ajax异步请求

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd“>
<html>
<head>
<title>评论</title>
<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>
</head>
<style>


show{ background:pink;padding:10px 20px; width:761px;margin:10px auto; border-radius:6px;}

  #show p{ margin:6px; font-size:13px; line-height:22px; border-bottom:1px dashed #666666;} 
</style>
<script class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="kindeditor/kindeditor.js"></script>
<script class="lazyload" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-original="kindeditor/jquery-1.4.js"></script>
<body>
  <form action="sent.php" method="post">
    <table align="center" style="background:#00ff99" width="800px">
      <tr>
        <th>用户评论</th>
      </tr>
      <tr>
        <td>
                          用户名:<input type="text" name="name"  id="name" required/>
        </td>
      </tr>
      <tr>
        <td>用户评论</td>
      </tr>
      <tr>
        <td>
          <textarea name="content" id="content" requered></textarea>
        </td>
      </tr>
      <tr>
        <th>
          <input type="submit" id="input" value="发表评论"/>
          &nbsp;
          <input type="reset" value="重置"/>
        </th>
      </tr>
    </table>
  </form>
 <div id="show">
    {foreach $viewall as $v}
    <p><b style="color:#f00">&nbsp;{$v.name}</b>发表了:&nbsp;{$v.content}</p>
    {/foreach}
    <span id="span" style="color:red"></span>
  </div>
 </body>

  <script type="text/javascript"> 
  //编辑器

KindEditor.ready(function(e){
e.create(“[name=content]”,{
width:”750px”,
height:”200px”,
“items”:[“undo”,”redo”,”|”,”bold”,”italic”,”underline”,’wordpaste’,
‘cut’,’|’, ‘justifyleft’, ‘justifycenter’, ‘justifyright’,
‘image’,
‘insertunorderedlist’, ‘indent’, ‘outdent’, ‘subscript’]
})
});
</script>
<script>
/ if(KE.count(‘content’,’text’)==””){
alert(“请输入内容”);
return false;
}
/

</script>
</html>

点赞