5

I am trying to get the JSON data from a URL that outputs the following JSON data:

[
 {
    "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"
 }
]

(Note: it is only formatted in this question for easier reading.)

Now I am trying to parse through it using this simple jQuery script:

<script>
    var url = "http://mySite.com/data.json";
    $.getJSON(url, function(data){
        alert(data);
        });
</script>

I am getting no data from the URL as the alert will not show. Any ideas on why this is not working?

4

1 回答 1

4

跨域你不能做简单的 JSON。

跨域 jsonp 的基本操作方法

阅读跨域请求。

于 2013-02-06T16:26:58.973 回答