如何使用jquery动态获取文件中的数据?

如何使用jquery动态获取文件中的数据?,jquery,html,listview,jquery-mobile,local-storage,Jquery,Html,Listview,Jquery Mobile,Local Storage,我试图获取显示在页面内容部分的数据。在主页中,我使用ajax加载一个xml文件,它在列表视图中显示数据。当我们点击列表中的项目时,它会在一个单独的页面中打开该相关文件,该页面是动态创建的。因此,每个项目都包含单独的文件,该文件位于.txt文件中。在该动态页面[data role=content]中,我正在加载一个包含该项目相关数据的文件。我想获取文件数据 创建用于在文件中显示数据的动态页面: $($.mobile.pageContainer).append('<div data-role=

我试图获取显示在页面内容部分的数据。在主页中,我使用ajax加载一个xml文件,它在列表视图中显示数据。当我们点击列表中的项目时,它会在一个单独的页面中打开该相关文件,该页面是动态创建的。因此,每个项目都包含单独的文件,该文件位于.txt文件中。在该动态页面[data role=content]中,我正在加载一个包含该项目相关数据的文件。我想获取文件数据

创建用于在文件中显示数据的动态页面:

$($.mobile.pageContainer).append('<div data-role="page" id="' + seq + '" class="items">
  <div data-role="content" id="desc"></div>
  <div data-role="footer" data-position="fixed" class="my-footer">
  <div class="ui-block-a ui-bar-a" data-theme="a">
  <div align="left" style="padding-left:5px;padding-top:3px;height:33px;height:40px;">
  <a href="#home" class="ui-btn-left" data-role="button" data-icon="home" data-iconpos="notext"></a>
  </div></div>
  <div class="ui-block-b ui-bar-a"><div align="center" style="padding-top:3px;height:33px;text-align:center;height:40px;">
  <div style="padding-bottom:7px;"><a href="" data-role="button" class="addToFavoritesDiv">Bookmark</a>
  <a href="" data-role="button" class="shareDiv">Share</a></div></div></div><div class="ui-block-c ui-bar-a">
  <div align="right" style="padding-top:3px;height:33px;height:40px;">
  <a href="#" class="ui-btn-right" data-role="button" data-icon="back" data-rel="back" data-iconpos="notext"></a></div></div></div></div>');

$('[data-role=page]#' + seq + ' [data-role=content]').load(file);
所以我想当我在本地存储中获取url时,如果我们上下滑动,它也会加载其他文件。有没有办法获取文件中唯一选定的数据

提前谢谢

var url = $(location).attr('href');
var demo = localStorage.getItem(url);
// var s = '<li data-role=\"list-divider\"></li>';
$("#favoritesList").append('<li id="add"><a href="' + url + '" style="text-decoration:none;color:black">' + demo  + '</a></li>').attr('url', url);