我正在尝试从输出以下JSON数据的URL获取JSON数据:
[
{
"belief_desc":"Jesus Died For Your Sins",
"0":"Jesus Died For Your Sins"
},
{
"belief_desc":"People Are Sinful",
"0":"People Are Sinful"
},
{
"belief_desc":"God Loves You",
"0":"God Loves You"
},
{
"belief_desc":"We Must Receive Christ",
"0":"We Must Receive Christ"
}
]
(注意:它仅在此问题中格式化以便于阅读。)
现在我正在尝试使用这个简单的jQuery脚本解析它:
<script>
var url = "http://mySite.com/data.json";
$.getJSON(url, function(data){
alert(data);
});
</script>
我没有从URL获取数据,因为警报不会显示。关于为什么这不起作用的任何想法?