Results 1 to 2 of 2

Thread: URGENT::How do I get data into a dojo border container using Ajax?

  1. #1
    Join Date
    May 2011
    Posts
    2

    Exclamation URGENT::How do I get data into a dojo border container using Ajax?

    I am doing a project and I have a problem. I have retrieved data from a json file using ajax and the xmlhttprequest, but I am not able to put the content I retrieve into the dojo content pane. The content pane is inside a border container.

    I have tried the following, but it does not work. The HTMLPage4.html has the json data inside.



    function getInfoContent(graphic)
    {
    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 placeImg = ""
    var txt = ""
    // placeImg += rssent[i].descImg
    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",
    style: "height: 11.5%; width: 100%; color: black; background-color: transparent; border:0px;",
    content: "<table><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", "HTMLPage4.htm", true)
    mygetrequests.send(null)
    }


  2. #2
    Join Date
    Mar 2011
    Posts
    53
    I'm not a dojo guy, but have you tried watching liveheaders and firebug? That usually will tell you what's failing.

Similar Threads

  1. Urgent: how to use ajax with json
    By cutexxbaby in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 21 May 2011, 11:35 PM
  2. Reading AJAX data
    By cmccully in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 19 Sep 2010, 02:01 AM
  3. dojo+addRow to DataGrid
    By lkofman1 in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 26 Aug 2009, 08:57 AM
  4. JQuery vs. Dojo ToolKit
    By grahamallen in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 20 Mar 2009, 02:27 AM
  5. help with shadow border on container
    By RN525 in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 28 Feb 2009, 12:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •