Dynamic pages with jQuery Mobile

后端 未结 4 2111
一生所求
一生所求 2021-02-08 10:59

I\'ve been using jQuery for quite a while, and taking my first steps with jQuery Mobile.

I use index.html as the jQuery Mobile & design of my app, which calls the co

4条回答
  •  遇见更好的自我
    2021-02-08 11:08

    Here's what I came up to solve this for my page

    $("#masterList").empty();
    var listItems = "";
    $.each(data.Messages, function (i, item)
    {
        listItems += "
  • "; } $("#masterList").append(listItems);

    For the detailPage I used the pageshow event handler to fetch the JSON object using the id and loaded the detail item based on the id in the detailId attribute - something like loadDetail($("#detailPage").attr("detailId")) and my loadDetail function did the rest.

    Unfortunately this will break the URL strategy for jQuery mobile. Since the selected item is stored in the page itself - this is no good. I am going to try using an external link that is an HTML page and passing the id as an arg.

提交回复
热议问题