<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.11.0/jquery.js"></script>
<title>Document</title>
</head>
<body>
<script>
// $.get(),$.post $.().load()
$(function () {
$.ajax({
type: 'get',
url: 'https://api.asilu.com/weather/',
data: {
city: '深圳',
},
dataType: 'jsonp', // 会自动的创建script 标签 解决跨域
success: function (res) {
console.log(res);
},
error: function (msg) {
console.log(msg);
},
});
});
</script>
</body>
</html>
网友评论