Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

Filling a List by using javascript

I am reading some data from a JSON-file and want to display the results (var lavername in the following code) in a list item on the screen (for example mobilescreen2). Any suggestions?

Here is the code for getting my results:

count = data.Geocockpit.length;

var countlayers = 0;

Code: Select all

       while (countlayers < count) {     

           $.each(data.Geocockpit[countlayers], function (layername, value) { 
   alert("Categorie: " + layername);            
  }); //$.each       

           countlayers++; 

       } //end while;
Bernie
Posts: 0
Joined: Fri Jul 27, 2012 2:06 pm

Filling a List by using javascript

Here is the solution:

count = data.Geocockpit.length;

var countlayers = 0;

Code: Select all

       while (countlayers < count) {     

           $.each(data.Geocockpit[countlayers], function (layername, value) { 
   //alert("Categorie: " + layername);                  
 var list = Tiggr("mobilelist1");           

 list.append("lia rel="nofollow"" + layername + "/a/li").listview("refresh");     

           countlayers++;         
  }); //$.each       

       } //end while;

Return to “Issues”