Links within a .load object(?) needs to reference the parent/caller
Hi! I'm new to jQuery and Javascript overall, I have searched the internet to make use of jQuery instead of the HTML's iframe tag.
I have some problems setting things up, I'm going to explain it the best I possible can. English isn't my main language so please forgive me for spelling/grammar errors. I didn't know what to use for title on this thread, so forgive me again if I used the wrong words.
My problem is links inside a .load file, I want them to refresh the box on the index.php file, not the file itself (in this case the links are in blog.php)
Here's everything I can provide with:
Files:
"index.php"
"blog.php"
In my index.php file I have this script to make my index.php links open the required file in my div box.
"index.php"
- <script language="javascript" type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
- $("#html").load("blog.php"); // shows the blog.php when I first enter index.php, which I want to have
- $(".link_click").click(function(){
- $("#html").load($(this).attr("id"));
- });
- });
- </script>
Here's "index.php" link:
- <a class="link_click" id="blog.php">Blog</a>
Here's my div box in "index.php" where I show the information within the loaded file:
- <div id="html"></div>
All this works, but here's my problem, I have multiple links within "blog.php" which I want to make "index.php" to refresh the "index.php"'s html div. Is there some kind of way to edit the "blog.php"'s script to make it "index.php" the parent or reference?
"blog.php"
- <script type="text/javascript">
- $(document).ready(function(){
- $(".link_click").click(function(){
- $("#html").load($(this).attr("id")); // Need to change this(?) to make it reference the index.php's html div box
- });
- });
- </script>
I hope you understand my question(s) and I hope this isn't too much to ask.
Thank you for your time and have a good day. (If you want to, you can view my W.I.P site where I am building this on saucy.se/new/ - W.I.P - just click the links at the top and it will show the info in my html div, but the links inside the html div opens a new window, also ignore the nonsense text I have in there. :))