fire event after opening page

fire event after opening page

Hello,

I want to load a dynamic data when opening new page, but i cant get to the onload event...
How can I call function immediately after loading a new page ?
here is my code in each file

Index.html :

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
</head>
<body onload="alert('home page');">
<!-- Home -->
<div data-role="page" id="page1">
    <div data-theme="a" data-role="header">
        <h3>
            testing
        </h3>
    </div>
    <div data-role="content">
        <div class="ui-grid-a">
            <div class="ui-block-a">
                <a data-role="button" data-transition="slide" href="addItem.html">
                    Add item
                </a>
            </div>
            <div class="ui-block-b">
                <a data-role="button" data-transition="slide" href="items.html">
                    Archives
                </a>
            </div>
        </div>
    </div>
</div>
</body>
</html>


items.html:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>test</title>
 <script>
    $(document).ready(function(){
      alert('hello from ready');
    });
 </script>
</head>
<body onload="alert('hello from onload')">
</body>
</html>















After i open index.html the alert is shown,
but in the items.html, it didnt... not on the onload event and not on document.ready...

Thank you for helping, Roy.