XMLHttpRequest cannot load http://www.server.com/server.php. No 'Access-Control-Allow-Origin' header is present on the requested resource.Origin 'http://www.client.com' is therefore not allowed access

jquery.easyui.min.js:5313 Uncaught TypeError: $.fn.validatebox.methods[_3bc] is not a function
fy_scan_file_tab.do?gjMethod&sn=100:1 XMLHttpRequest cannot load http://IP地址:8088/archivesManage/yw_file.do?getXMLMessage&ftpPath=ftp:…IP地址:21/2017-09-19/%5B1971%5D%E8%81%8A-%E6%B0%91%E7%AC%AC102%E5%8F%B7. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8088' is therefore not allowed access.
fy_scan_file_tab.do?gjMethod&sn=100:1 XMLHttpRequest cannot load http://IP地址:8088/archivesManage/yw_file.do?getPicListBeforeGJ&filePat…IP地址:21/2017-09-19/%5B1971%5D%E8%81%8A-%E6%B0%91%E7%AC%AC102%E5%8F%B7. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8088' is therefore not allowed access.      

No 'Access-Control-Allow-Origin' header is present on the requested resource. 在项目开发中遇到该问题,从网上看到资料说是ajax异步访问造成的。这是因为搜索的方向错误了重点关注'http://localhost:8088' is therefore not allowed access. 这一部分。发现请求的方式不一致,请求路径是localhost,而实际路径中应该是ip地址。修改请求路径后发现问题解决。因为是用idea开发的在configurations 中修改访问路径后解决。 

   另外需要补充一点的是,关注下报错的访问路径跟实际访问路径,如果不一致但是项目在自己电脑上能正常使用,考虑下路径是截取了数据库中的部分字段,因为写死了造成换机器后不能使用了

本人经验尚浅,从之前同行的分享中受益颇多,希望我的分享也能帮助到其他同行。我会继续努力的。让我们一起加油。

 

原文地址:https://www.cnblogs.com/a6948076/p/8004949.html