0

在我的 android 应用程序中我使用导航栏动态创建但它没有正确创建请帮我找出我做错了什么

如果我删除 li 标签,它会来但不是以正确的方式

在一个.xml 中:-

<cat>
  <id>1</id>
</cat>
<cat>
  <id>ATTR11</id>
</cat>

在 JQuery 中:-

var a2 = "";
var a1 = "";
var reg = new RegExp('^[0-9]+$');
$.ajax({
  type: "GET",
  url: "one.html",
  contentType: "text/xml",
  dataType: "xml",
  data: "",
  success: function (xml) {
    $(xml).find("cat").each(function () {
        var id = $(this).find('id').text();
        if (id.match(reg) !== null) {
            a2 = a2 + '<a href="#">' + id + '</a>';

        } else {
            a1 = a1 + '<li><a href="#">' + id + '</a></li>';

        }
        $("#xyz").append(a2).trigger('create');
        $("#abc").append(a1).trigger('create');
    }
    });

在 HTML5 中:-

<div data-role="navbar" data-iconpos="top" >
  <ul id="abc"></ul>
</div>
4

0 回答 0