axios-使用axios发起基本的GET请求

Young_Yang_Yang / 2023-06-13 / 原文

axios是一个专注于网络请求的库!

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script src="lib/axios.js"></script>
		<script>
			//1.调用axios方法得到的返回值是Promise对象
			const result = axios({
				method: 'GET',
				url: '127.0.0.1:8080/axios/get'
			})
			result.then(function(res){
				console.log(res)
			})
		</script>
	</body>
</html>