前端向后端发起请求的方法(get,post)

前端向后端发起请求的方法

var xmlhttp2;
let path2 = getQrPath2 + "/" + uuid;
xmlhttp2 = new XMLHttpRequest();
xmlhttp2.open("GET", path2, true);
xmlhttp2.responseType = "blob";
// xmlhttp2.onload = function () {};
xmlhttp2.send();
$.get(
  path2,
  function (data, textStatus) {
    console.log("回调了");
  },
  "daxue"
);
axios
  .get(path2, {
    params: { dd: "cc" },
  })
  .then(
    function (success) {
      console.log("成功");
    },
    function (fail) {
      console.log("失败");
    }
  ).catch(function(error){
    console.log("异常");
  });
axios({
  method: "get",
  url: path2,
  params: {
    firstName: "Fred",
    lastName: "Flintstone",
  },
});

你可能感兴趣的:(前端)