8 Replies Latest reply on Feb 21, 2013 9:26 AM by joel_pau

    Help?! From Ajax to Stage

    Comfunex Level 2



      having a mind bender with Ajax...


      I am creating (with help from joel Pau) a gallery of symbols that rotates in a container div.


      the information comes from an Ajax parser for XML:


      function getajax(){


                type: "GET",

                url: "xml/data.xml",

                dataType: "xml",

                success: function(xml){

                         var width1 = 0;

                                              $(xml).find('project').each( function(){

                                              var itemRenderer = sym.createChildSymbol("project", "container");

                                              itemRenderer.getSymbolElement().css({"position":"relative", "display": "inline-block"});



                                              var img_obj = $(this).find('project_image').text();

                                              itemRenderer.$('project1').css("background-image","url('images/projec ts/"+img_obj+"')");

                  var url = $(this).find('url').text();

                                              itemRenderer.$('text_butt').on("click", function(){window.open(url,"_blank");});

                                              width1 = width1 + 306;




                }, //success

                error: function(){ //adding an error message here

                                              window.alert("error loading XML");





      i want to trasfer data from the ajax to the stage, more specificly i want to get the newly created width of the container (after being filled with all the symbols) to a variable on the stage.


      I was succeful in displaying the variable with $("#Stage_Text").html(width1+"");

      but part of that outside the ajax function nothing worked to retrieve the inner text that I want to use in a variable


      not set / get variable , innerHTML, innerText, text() etc...


      I am sure there is a way because i can see in the console that the data is there.


      but I can't reach it.


      please Help,