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

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>
posted @ 2023-06-12 23:23  Young_Yang_Yang  阅读(90)  评论(0编辑  收藏  举报