-1

Hello i am having trouble calling and using (displaying) my JSON Data

I have spent awhile now trying to do this and i can tell i am missing something possible obvious.. but it's just not happening.

My aim is to get and display the data in the JSON Array below form another domain/device (mobile app)

I've been looking at the following resources and have put of asking this question for awhile but i can't seem to get anything to work as it should.

http://api.jquery.com/jQuery.getJSON/

How to get JSON from URL in Javascript?

Changing getJSON to JSONP

My array (hosted on the URL above)

    [  
       {  
          "id":"1",
          "category":"Mainstream",
          "genre":"Action",
          "title":"ALDNOAH.ZERO",
          "description":"Humanity has clearly split into two and currently there is no way these groups will once again unite. Humanity celebrates this transient time of peace as they slowly dismiss from their minds the scars their ancestors bore in the past. No one realized that with one little push their world can fall to its destruction.",
          "image_link":"aldnoanzero.jpg",
          "date_added":"2015-02-17"
       },
       {  
          "id":"2",
          "category":"Mainstream",
          "genre":"Comedy",
          "title":"SKET Dance",
          "description":"At Kaimei High School, the Living Assistance Club (aka the Sket Brigade) was organized to help students with problems big or small. Most of the time, though, they hang out in their club room, bored, with only a few trivial problems floating in every once in a while. In spite of this, they still throw all their energy into solving these worries.",
          "image_link":"sketdance.jpg",
          "date_added":"2015-02-17"
       },
       {  
          "id":"3",
          "category":"Hidden Gems",
          "genre":"Science Fiction",
          "title":"Time of eve",
          "description":"Time of Eve (Eve no jikan) series is the latest work by Yasuhiro YOSHIURA, who stunned the anime world with Pale Cocoon and Aquatic Language (Mizu no kotoba).",
          "image_link":"timeofeve.jpg",
          "date_added":"2015-02-17"
       }
    ]
Community
  • 1
  • 1
Benjamin
  • 657
  • 2
  • 10
  • 31

2 Answers2

1

You need your endpoint (the page you are accessing the JSON from) to set the Access Control allow origin to all origins so that the browser can make the client side request.

If that's done then you can use the jQuery $. get() method to access the JSON data.

I'm Geeker
  • 4,601
  • 5
  • 22
  • 41
geekpradd
  • 418
  • 2
  • 9
0

I think XMLHttpRequest cannot load https://nani.io/json_data.json No 'Access-Control-Allow-Origin' header is present on the requested resource.