的AoA, 我不知道为什么下面的功能不起作用,或者它有时有效,有时会失败! :(
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'></script>
<script type="text/javascript">
$(document).ready(function(){
$.ajax({
url: "{% url 'GetNotSize' %}?user={{ username }}",
success:function(data){
alert(data);
}
});
});
</script>
源视图中的上述url:url:“/ GetSize /?user = saad_lah”, 它工作得很好......但是当我重新启动服务器时, 它没有显示任何内容......浏览器控制台中没有警告或错误。无法弄清楚错误是什么......
答案 0 :(得分:1)
Google不允许您在此类CORS(跨域)请求中访问其服务器。
XMLHttpRequest cannot load http://www.google.com/?_=1386263558835. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://stackoverflow.com' is therefore not allowed access.