html 为Yu Yu-Ren Pan撰写CRSC2014留言簿的前端! (仅用于调试)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 为Yu Yu-Ren Pan撰写CRSC2014留言簿的前端! (仅用于调试)相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html>
<head>
  <title>Guestbook Test</title>
  <script src="res/js/jquery-1.10.2.min.js"></script>
  <script>
  $(function(){
    $("#gb_form").submit(function(){
      $("#gb_submit").attr("disabled","disabled");
      sendForm();
      return false;
    });
    $("#gb_admin_form").submit(function(){
      $("#gb_admin_submit").attr("disabled","disabled");
      sendAdmin();
      return false;
    });
  });

  function sendForm(){
    var postdata=new FormData();
    postdata.append("name",$("#gb_field_name").val());
    postdata.append("email",$("#gb_field_email").val());
    postdata.append("related",$("#gb_field_related").val());
    postdata.append("comment",$("#gb_field_comment").val());
    postdata.append("pass",$("#gb_field_pwd").val());
    $.ajax({url:"gbapi.php?action=write",
      method: "POST",
      data: postdata,
      processData: false,
      contentType: false,
      dataType: "json",
      success: function(data){
        console.log(data);
        $("#gb_submit").removeAttr("disabled");
      }
    });
  }

  function sendAdmin(){
    var postdata=new FormData();
    postdata.append("pass",$("#gb_admin_field_pwd").val());
    postdata.append("comment",$("#gb_admin_field_comment").val());
    $.ajax({url:"gbapi.php?action=hide",
      method: "POST",
      data: postdata,
      processData: false,
      contentType: false,
      dataType: "json",
      success: function(data){
        console.log(data);
        $("#gb_admin_submit").removeAttr("disabled");
      }
    });
  }
  </script>
</head>
<body>
  <form id="gb_form">
    <div><label>暱稱:<input id="gb_field_name" type="text"/></label></div>
    <div><label>電子郵件:<input id="gb_field_email" type="email"/></label></div>
    <div><label>回覆串(除錯用):<input id="gb_field_related"/></label></div>
    <div><label>密碼:<input id="gb_field_pwd" type="password"/></label></div>
    <div><textarea id="gb_field_comment" placeholder="留言..." rows="6"></textarea></div>
    <button id="gb_submit" type="submit">送出</button>
  </form>

  <form id="gb_admin_form">
    <div><label>密碼:<input id="gb_admin_field_pwd" type="password"/></label></div>
    <div><label>訊息:<input id="gb_admin_field_comment" type="text"/></label></div>
    <button id="gb_admin_submit" type="submit">送出</button>
  </form>
</body>
</html>

以上是关于html 为Yu Yu-Ren Pan撰写CRSC2014留言簿的前端! (仅用于调试)的主要内容,如果未能解决你的问题,请参考以下文章

Linux下编译安装MySQL

hdu 5383 Yu-Gi-Oh!

用jquery根据json动态创建多级菜单导航(by https://www.cnblogs.com/fatty-yu/p/7088955.html)

python基础2

UE5 UE4 WorldCreator地形快速制作

推荐几个适合新手练手的Python项目