Thursday, May 10, 2012

YQL + JSON issues

Tried almost everything to get some JSON from YQL and just could not loop through the items. What worked was to parse the JSON using JSON.parse(jsondata). No problems there after.

var getStockQuote = function () {
        var url = "/api/stockquote/sd";
       
        $.getJSON(url, function (data) {
            var json = JSON.parse(data);
            $.each(json.query.results, function (i, results) {
                formatting.updateSecurity(results);
            });
        });

No comments:

Post a Comment