First time posting here so take it easy with me, lol. I’m currently trying to load content into my “pages” that I have already written the html out for. My jquery script is reading the data in from my xml file content.xml. My first page loads fine, but the pages I’m trying to insert data into it have nothing in them. I’ve deliberately created each page as a shell to avoid data-url issues.
Here’s snippets of my code (lots of repetition so no point in putting it all in):
Jquery:
$(function () {
$.ajax({
type: "GET",
url: "content.xml",
dataType: "xml",
success: xmlParser
});
});
function xmlParser(xml) {
$(xml).find('Phonetic').each(function () {
var a = 1;
$test = $("s" +a).append('<div><div class=<div class="S3">' +
$(this).find("S3").text() +
'</div>"S1">' +
$(this).find("S1").text() +
'</div><div class="S2">' +
$(this).find("S2").text() +
'</div><div class="S4">' +
$(this).find("S4").text() +
'</div></div>');
$test.page();
a++;
});
}
Here’s the html:
<div data-role="page" id="c1">
<div data-role="header"><h1>Test</h1></div>
<div data-role="content" id="s1"></div>
<div data-role="footer"><h1>Test release v1.0 - Android tablet test</h1></div>
</div>
Any help would be great!
i have just one page, the key is to have pagebeforechange in your document ready or ondeviceready function.
so thats your way in, you now need a function to process the page and show the html, here is what i do:
below is code to show when navigating to a page that nees a value for example #person?personid=22 my page is person and i will be taking the id [ personid ] and getting the correct info, i will then populate my ALLPAGES page with the content and make jquery think i am actually on #person.
}
thats all you need, its all i ever use, i dont think i have seen examples like this i have had to basically turn my entire app into this way of working to reduce the memory usage on iphone 2 when using as a phonegap app, and it is very very very quick with full ajax navigation.
points to note is that you only need hashtag navigation, in your pagebeforecreate set up a new if for every page you want. w
well hope it helps
as requested here is the html for my page: