页面加载时执行ajax

I want to execute ajax when a page load but it does not work!. I want to run the code only when the second page loads. This jquery code:

$("#mydiv").on('load', this, function(){        
         alert('loaded');

    return false;           

}); 

html code: the second page has got a div:

 <div id"mydiv"></div>

Please help me to fix this issue so I can process the ajax request. Thank you.

why dont you execute ajax on document ready ?

$(document).ready(function(){        

    alert('loaded');
});