-2

I want to pull data (title, author, etc) from this json file: http://www.nba.com/grizzlies/api/v1/json

How would I go about this in Javascript/jQuery? I can't seem to be able to.

  • 1
    that url is not CORS enabled. Also when asking about `how` you need to post code you have tried ... this isn't a code writing service...people help you with code you write – charlietfl Sep 28 '15 at 01:42
  • [It is JSONP](http://www.nba.com/grizzlies/api/v1/json?callback=parsejson) enabled tho. – Andy Sep 28 '15 at 01:46
  • i'll look into JSONP, but I've tried something from this tutorial: http://beautifulbeta.wikidot.com/json-feeds – hellothere Sep 28 '15 at 01:50
  • possible duplicate of [Safely turning a JSON string into an object](http://stackoverflow.com/questions/45015/safely-turning-a-json-string-into-an-object) – Jesse Sep 28 '15 at 02:15
  • possible duplicate of [Parse JSON in JavaScript?](http://stackoverflow.com/questions/4935632/parse-json-in-javascript) – NaviRamyle Sep 28 '15 at 02:23

1 Answers1

0
$.ajax({
    type: 'GET',
    url: "http://www.nba.com/grizzlies/api/v1/json",
    dataType: "jsonp",
    success: function (data) {
        console.log(data);
        $.each(data, function (index, value) {
            $.each(value, function (idx, val) {
                console.log(val.author);


            })


        })

    },
    error: function (data) {

    }
});

If you want to try demo below.

Demo

guradio
  • 15,524
  • 4
  • 36
  • 57