2015-02-24 62 views
-1

您好我無法調用和使用(顯示)我的JSON數據GET JSON從URL - jQuery的

我花了一段時間,現在想這樣做,我可以告訴我缺少的東西可以顯而易見的..但它的只是沒有發生。

我的目標是獲得並在JSON陣列以下表格其他域/設備(手機應用程序)顯示數據

我一直在看下面的資源和已經把問這個問題一段時間,但中我似乎無法得到任何應有的工作。

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

How to get JSON from URL in Javascript?

Changing getJSON to JSONP

我陣列(託管在上述網址)

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

回答

1

您需要根據您的端點(你正在訪問的JSON頁)以將訪問控制允許來源設置爲所有來源,以便瀏覽器可以使客戶端請求。

如果這樣做,那麼您可以使用jQuery $. get()方法來訪問JSON數據。