I have the following php pages main.php content.php
main.php
When the user clicks a link the content.php page is loaded in a div in main.php page.The main.php when loaded contains a separate script file that has scripts for content.php page. The script works fine when I include it in the content.php but does not work when i place it in a separate file in the head section of main.php What is the reason for this?
JS File
$(function(){
$('#new').click(function(event){
event.preventDefault();
$('#content').load('content.php');
});
$('#rank').click(function(event){
alert("This works!!");
event.preventDefault();
});
});
main.php
<div id="container">
<div id="header">
</div>
<div id="nav">
<a href="#" id="new">New Page</a>
</div>
<div id="content">
/*** Pages get loaded Here ***/
</div>
<div id="footer">
</div>
</div>
content.php
<a href="#" id="rank">jQuery Test</a>