第一种 也是最古老的一种方法之一

from 表单直接提交数据到php文件里

action为路径

        <form method="post" action="./index.php">
            <input name="username" placeholder="用户名"  type="text"  >
            <input name="password"placeholder="密码" type="password">
            <input value="登录" type="submit">
        </form>

 

 

data为要传递的参数  

$.post(路径,{"data":data},function(a){
    alert(a);
},"json");

 

jq提交方式

$.ajax({
   url:"./index.php",
   type:"post",
   data:{username:username},
   dataType:"json",
   success:function(a){
      alert(a)
   },
   error:function(e){
      alert("错误");
    }
});

相关文章:

  • 2022-02-05
  • 2021-12-06
  • 2021-11-22
  • 2021-05-23
  • 2022-12-23
猜你喜欢
  • 2021-04-01
  • 2022-01-20
  • 2022-12-23
  • 2021-08-02
  • 2021-11-22
  • 2021-12-19
相关资源
相似解决方案