开发者

read a json object with dojo toolkit

am trying to read a json object with dojo toolkit, but the dojo.forEach do not work so , how can i read this 开发者_如何学运维object?

this is my code:

function loadThemes() {
    themes= " ";
    // The "xhrGet" method executing an HTTP GET
    dojo.xhrGet({
        url: "theme/consult",
        handleAs: "json",
        headers: { "Content-Type": "application/json", "Accept" : "application/json"},
        load: function(jsonData) {
            var content = "";

            dojo.forEach(jsonData.theme,function(themes) {
                content+= "<h2>" + themes.name + "</h2>";
                content+= "<p>" + themes.description + "</p>";
            });

            dojo.byId("themes2").innerHTML = content;
        },

        error: function() {
            dojo.byId("themes2").innerHTML = "News is not available at this time."  
        }
    });
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜