$.get() • GET 请求快捷方法 • $.get(url, data, callback)

<script src="js/jquery-1.12.4.min.js"></script>
  <script>
    // 发送 get 请求
    // $.ajax({
    //   url: "http://localhost:3000/comments",
    //   type: "get",
    //   dataType: "json",
    //   data: {"id": 2},
    //   success: function (data) {
    //     console.log(data);
    //   }
    // })

    // 化简后的方法直接发送 get 请求
    $.get("http://localhost:3000/comments", {"id": 1}, function (data) {
      console.log(data);
    })
  </script>

更多推荐

jquery的AJAX的GET 请求