bashir saboori bashir saboori - 2 months ago 6
Javascript Question

access to json Api objects using jquery

I want to get access to json api objects using jquery:


and i'm using this jquery code to get time data:

jQuery.getJSON("" + co + "", function(data) {
jQuery.each(data, function(key, val) {
jQuery('input[name=' + key + ']').val(val);
if (key == "schedule") {
var tim = "";
jQuery.each(data.schedule, function(i, item) {
tim += item.time;

but nothing will show in output!

please help!

"network":{"id":128,"name":"KBS2","country":{"name":"Korea, Republic of","code":"KR","timezone":"Asia/Seoul"}}

if (key == "schedule") {
    // val == {"time":"22:00","days":["Wednesday","Thursday"]}

Since you already have access to the result of schedule, you don't need to create another loop. Just access the time directly.