in ajax navigation pages, the classic "document ready" form for performing initialization javascript simply doesn't fire.
What's the right way to execute some code in an ajax loaded page?
(I mean, not my ajax... it's the jquery mobile page navigation system which brings me to that page)
Ok, I did suspect something like that... thanks a lot =) But... it still doesn't work, here's my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>mypage</title>
<link rel="stylesheet" href="jquery.mobile-1.0a4.min.css" />
<script type="text/javascript" src="jquery-1.5.min.js"></script>
<script type="text/javascript" src="jquery.mobile-1.0a4.min.js"></script>
<script type="text/javascript">
$('div').live('pageshow',function(event, ui){
alert('ciao');
});
</script>
</head>
<body>
<div data-role="page">
<div data-role="header" data-position="fixed">
<h1>Shopping Cart</h1>
</div>
<div data-role="content"> asd
</div>
</div>
</body>
Do I need to specify the div id?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…