Jquery json url parameter

I am trying to get 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 easy reading.)

Now I'm trying to parse it using this simple jQuery script:

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

I am not getting any data from the url as the warning will not be displayed. Any ideas on why this is not working?

+5
source share
1 answer

Cross domain, you cannot do simple JSON.

Basic instructions for jsonp cross-domain

Reading requests for cross-domain requests.

+4
source

All Articles