bfunc({
"query": {
"count": 1,
"created": "2013-05-03T06:20:01Z",
"lang": "en-US",
"diagnostics": {
"publiclyCallable": "true",
"cache": {
"execution-start-time": "32",
"execution-stop-time": "32",
"execution-time": "0",
"method": "GET",
"type": "MEMCACHED",
"content": "http://www.vtualerts.com/robots.txt"
});
这是我需要使用 javascript 和 jQuery 解析的 JSON 数据。我试着这样做......
<div id="placeholder"></div>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script>
$.getJSON('myjson.json', function(data) {
var output= data.cbfunc.query.count+ "" + data.cbfunc.query.created;
document.getElementById("placeholder").innerHTML=output;
});
但我收到一个错误
XMLHttpRequest 无法加载 file:///home/shivratna/Desktop/myjson.json。Access-Control-Allow-Origin 不允许 Origin null。
请帮忙。
真诚的感谢