<script>
$.ajax({
url: ‘接口地址’,
type: ‘POST‘,
async:true, //异步
xhrFields:{
withCredentials:true //跨域
},
data: {
},
success: function(res){
console.log(res)
},
error: function(){
alert(‘服务器发生错误!‘);
}
})
</script>
原文:https://www.cnblogs.com/yangshousheng/p/10370122.html