Access to XMLHttpRequest at ‘XXX’ from origin ‘XX’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present o AJAX
跨域请求解决方法;
这个问题折腾了很久,有些建议说在浏览器的后面加
–allow-file-access-from-files
尝试无果。
换了服务器重新测试无果。
原代码如下:
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("#start").click(function(){
$.ajax({
url:"E:\\software\\install\\xampp\\htdocs\\GTZC\\test.html",
dataType : "html",
crossDomain: true,
async: true, // 使用同步操作
success:function(result){
$("#test").html(result);
},
});
});
});
</script>
嗯,然后换了个js版本,,然后我就用了百度的js
如下:
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js">
</script>
<script>
$(docu