开发者

read a json object with dojo toolkit

开发者 https://www.devze.com 2023-03-22 07:17 出处:网络
am trying to read a json object with dojo toolkit, but the dojo.forEach do not work so , how can i read this 开发者_如何学运维object?

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

精彩评论

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