cutexxbaby

Urgent: how to use ajax into dojo content panel

Discussion created by cutexxbaby on May 21, 2011
hi
i am doing a project and i meet so difficult i am using ajax to retrieve the data from json file however i want to put the data retrieve of each attribute into the a dojo border container which contain the content panel(the data is put here) so i was wonder how can i do it ( i only know must do everything in the for loop)...i try out but it don't work so i am not sure why

this is my code...the htmlpage is where i put my json data


function ajaxRequests() {
                var activexmodes = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
                if (window.ActiveXObject) { //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
                    for (var i = 0; i < activexmodes.length; i++) {
                        try {
                            return new ActiveXObject(activexmodes[i])
                        }
                        catch (e) {
                            //suppress error
                        }
                    }
                }
                else if (window.XMLHttpRequest) // if Mozilla, Safari etc
                    return new XMLHttpRequest()
                else
                    return false
            }
   
            var mygetrequests = new ajaxRequests()
            mygetrequests.onreadystatechange = function() {
                if (mygetrequests.readyState == 4) {
                    if (mygetrequests.status == 200 || window.location.href.indexOf("http") == -1) {
                        var bookss = eval("(" + mygetrequests.responseText + ")") //retrieve result as an JavaScript object
                        var rssent = bookss.infos.info
                        for (var i = 0; i < rssent.length; i++) {
   
                            // alert(mygetrequests.responseText);
                            var txt = ""
                              txt += rssent[i].desc
                            var shorttxt = ""
                            shorttxt += txt.substring(0, 30);
   
                            var bc = new dijit.layout.BorderContainer({ style: "font-size: 11pt; height: 574px; width:739px; border:0px;" });
                            var c1 = new dijit.layout.ContentPane({
   
                                region: "top",
                                 content: "<table><td><div id = \"mydiv\">" + shorttxt + "<font color = '#0000FF' size = '1'><a onclick='showmore();'><u>  More...</u></a></div></td></table>"
                            });
   
                            bc.addChild(c1);
                        }
                     
                    }
                     else {
                        alert("An error has occured making the request")
                    }
       return bc.domNode;
   
                }
            }
            mygetrequests.open("GET", "HTMLPage.htm", true)
            mygetrequests.send(null)

Outcomes