I am trying to get some data from a file, for example some.txt. I want to display some data in this file, as a description below each list in the list.
$(xml).find('section[order="' + order + '"] content').each(function () { var content = $(this).text(); var seq = order + '' + $(this).attr('order'); var file = $(this).attr('file'); $("#content").append('<li><a href="#" data-sequence="s' + seq + '" file="' + file + '">' + content + ' </a> </li> '); }); $("#content").listview('refresh'); });
In the above code, I created a listview. Now I have changed the code as shown below:
$("#content_list").append('<li><a href="#" file="' + file +'">' + content + ' </a><p class="description text"></p> </li> '); $(".description").each(function() { $(".text").load(file, function() { var txt = $(this).find('I').text(); $("#content_list").append('<p>' + txt + '</p>'); }); });
In the above code, the "file" attribute contains some .txt file. Using this file, I want to get some data to display the text as a description for the title in the list. I tried in many ways, but the whole file is displayed.
Thanks at Advance.
source share