如何动态创建不具有设定长度的ul?

时间:2013-06-10 01:03:11

标签: jquery list dynamic unordered

我知道我必须使用append()方法,但列表中的行项目数量每次都会有所不同,我不确定ul的哪个部分应该作为我的html的骨架。列表和哪个部分应该通过我的脚本动态添加append()。

/* 
 * The function I want to create the list queries my database and pulls rows
 * of data that I want to put into a list. The number of rows will vary. Ignore
 * everything up until the list of variables.
 */ 
var activityInfo = function(niche, actvtyId){

  var info = Parse.Object.extend(niche); 
  var query = new Parse.Query(info);

  query.equalTo("objectId", actvtyId);

  query.first({
    success: function(results) {
      var activity = results.get("activity");
      var ageGroup = results.get("ageGroup");
      var numPPL = results.get("numPPL");
      // I'm not sure if I should put an empty ul in my html and then add the
      // line items or what?   
      $('ul').append("<li>" + activity + ' ' + ageGroup + ' '+ numPPL"</li>");
    });
  }
}

0 个答案:

没有答案