我如何在ajax中宣布手风琴?

时间:2016-07-14 06:56:35

标签: jquery ajax

Ajax Part:这里我想在ajax中声明一个accordion类来循环数据库中的数据。如何将手风琴显示为从DB循环?

    var htmlAppend = jQuery("<div id='accordion'></div>").html(htmlTempItem).find('a[id ="collapse"]')
    //.attr('class', 'collapsed')
    .attr('role', 'button')
    .attr('data-toggle', 'collapse')
    .attr('data-parent', '#accordion')
    .attr('href', '#collapseTwo' + i + '')
    .attr('aria-expanded', 'false')
    .attr('aria-controls', 'collapseTwo' + i + '')
    .html('Property Item '+i+'').parents("div[data-id=accordion]").html();

    htmlAppend = jQuery("<div id='accordion'></div>").html(htmlTempItem).find('div[data-type="txtTitleNumber"]')
    .attr('data-TitleNumber', item.TitleNumber).html(item.TitleNumber).parents("div[data-id=accordion]").html();

这适用于HTML部分:

  <div class="panel panel-default">
  <div class="panel-heading" role="tab" id="headingTwo">
   <h4 class="panel-title">
      <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
      Property Item #
     </a>
   </h4>
   </div>
    </div>

0 个答案:

没有答案