ajax 请求

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

posted on 2019-02-13 15:38  牧己  阅读(99)  评论(0编辑  收藏  举报

导航