Before closing the body tag of my first.php page, I want to load pop.html by javascript. Both are sitting on the root folder of my public_html directory.
By using this code:
<script type="text/javascript">
$( "#modal-layer" ).load( "pop.html" );
</script>
It works when I access first.php directly:
http://www.example.com/first.php
But since I'm using a pretty URL for this page, such as:
http://www.example.com/pretty/first/
pop.html won't load because of the path.
How can I load it? the weird thing is that I even tried an absolute path:
<script type="text/javascript">
$( "#modal-layer" ).load( "http://www.example.com/pop.html" );
</script>
But even this didn't work.
Note that I need a universal solution rather than a path form that will go up only one level, as some of my pages have pretty urls that go deeper than one level.