1.Get 请求

<html>
    <head><script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script></head>
    <body>测试Get</body>
</html>
<script>
$(function(){
    $.ajax({
      type: "GET",
      url: "http://192.168.9.14:8290/api/admin/user/getMenus",
      success: function(msg){
         alert( "Data: " + msg );
       }
    });
})  
</script>

2.Post 请求

<html>
    <head><script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script></head>
    <body>测试post</body>
</html>

<script>
$(function(){
     $.ajax({ 
            type: "POST",
            url: "http://192.168.9.14:8290/api/admin/login",
            data: ('{"username":"admin","password":"e10adc3949ba59abbe56e057f20f883e"}'),
            contentType: "application/json",
            dataType: "json", 
            success: function (msg) { 
              console.log(msg);
            }
           });
})
</script>
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄