请问一下我点击加载时,json数据没有显示,是什么原因呢?
点击加载的时候报这个错是什么意思
XMLHttpRequest cannot load file:///G:/js%E5%AD%A6%E4%B9%A0/%E6%BB%9A%E5%8A%A8%E6%9D%A1/Data/fruit.json. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
<script type="text/javascript">
$(function () {
$("#btnShow").bind("click", function () {
var $this = $(this);
$.getJSON("Data/fruit.json",function(data){
$this.attr("disabled", "true");
$.each(data, function (index, fruit) {
$("ul").append("<li>" + fruit["name"] + "</li>");
});
});
})
});
</script>
json数据
var fruit={[{
"name":"足球"
},{
"name":"散步"
},{
"name":"蓝球"
},{
"name":"乒乓球"
},{
"name":"骑自行车"
}]};