<分区>
我是 jQuery 和 AJAX 的新手,我正在尝试以下代码,只是简单的 http get 请求。
<html>
<head>
</head>
<body>
<script src = "jquery-2.1.4.js"></script>
<script src = "app.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$.get("http://google.com", function(data, status){
alert("Data: " + data + "\nStatus: " + status);
});
});
});
</script>
<button>Send an HTTP GET request to a page and get the result back</button>
</body>
</html>
我得到以下错误
XMLHttpRequest cannot load http://google.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'file://' is therefore not allowed access.
请帮我看看我错过了什么。