原生js中用Ajax进行get传参

  案例:

  <!DOCTYPE html>
  <html>
    <head>
      <meta charset="UTF-8">
      <title></title>
      <style>
        input{
          width:600px;
          height:50px;
          display:block;
        }
      </style>
    </head>
    <body>
      <input type="text" name="id" ,mn,js);
    function mn(data){
      console.log(data);                               //在php中获取的数据
    }
  </script> 

  <?php
    $so=$_GET['id'];    //用get获取id的字段    与js中的id一致; 

    $ss=$_GET['name'];
    $mo=$_GET['money'];
    $bu=$_GET['bumen'];
    $arr=[];
    array_push($arr,$so,$ss,$mo,$bu);            //将他们放在数组里
    var_dump($arr);              //只能用var_dump展示出来;
?>

相关文章:

  • 2021-11-20
  • 2021-11-27
  • 2022-01-08
  • 2022-02-27
  • 2021-11-27
  • 2022-02-17
  • 2021-11-29
  • 2021-10-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
  • 2022-01-27
  • 2022-01-05
  • 2021-07-04
相关资源
相似解决方案