js请求后端接口测试代码html

<!DOCTYPE HTML>
<html>
<head>
  <!-- 在线引入jq -->
  <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>

<script type="text/javascript">
    $(function(){
    
    
        //按钮单击时执行
        $("#testAjax").click(function(){
    
    

              //Ajax调用处理
            $.ajax({
    
    
               type: "POST",
               url: "",//写入你的请求接口
               data: {
    
    
                 access_token: '73d1d43',//所需要的数据
                 id:'1'
               },
               success: function(data){
    
    
                       console.log(data,111)
                  }
            });

         });
    });
</script>
</head>
    <body>
        <div id="myDiv"><h2>通过 AJAX 改变文本</h2></div>
        <button id="testAjax" type="button">Ajax改变内容</button>
    </body>
</html>

猜你喜欢

转载自blog.csdn.net/m0_69327201/article/details/128971693