ajax fetch获取不到数据提示需要跨域(肯定没有跨域)

http://aabb:8088/Customer/index 请求 http://aabb:8088/Service/


$.ajax({

    url:'http://aabb:8088/Service/',

    type:'GET',

    success:function(data){

        console.log(data)

    }

})

XMLHttpRequest cannot load http://aabb:8088/Service/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://aabb:8088' is therefore not allowed access.


请求的url换成/Service/就正常了,请问这是为什么?


慕桂英546537
浏览 344回答 1
1回答

凤凰求蛊

因为 http://aabb:8088/Service/ 与 http://aabb:8088 是两个不同的域名
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript