I want to creat an Android Application with HTML, CSS, and jQuery.
I have tried to implement the .load()
function of jQuery on this way. It works on the browser but not as an Android Application. Is there an other solution, for example with AJAX?
$(document).ready(function() {
$('#nav li a').click(function(){
var toLoad = $(this).attr('href')+' #content';
$('#content').hide('fast',loadContent);
$('#load').remove();
$('#wrapper').append('<span id="load">LOADING...</span>');
$('#load').fadeIn('normal');
function loadContent() {
$('#content').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#content').show('normal',hideLoader());
}
function hideLoader() {
$('#load').fadeOut('normal');
}
return false;
});
});
Thanks
Edit:
i tried also this:
$(document).on('pageinit', function() {
// handle menu clicks
$("ul#nav li a").click(function() {
var page = $(this).attr("href");
$("#content").load(page + ".html");
});
});