View Full Version : Need help using iframe to only reload part of the page

07-19-2012, 01:05 AM
Hey guys,

The website that I'm working on is http://teaminmetsu.com
I'd like to make it so that the content_box div (the main box under the content slider) is the only part of the page that reloads when the user clicks on a link. Whether that be a link from the roster or the forums button in the navbar. Any help will be greatly appreciated.

Old Pedant
07-19-2012, 01:49 AM
So make it an <iframe>, as you said.

Links inside the <iframe> of the form <a href="xxx">zzz</a> will automatically replace the current iframe contents.

For links outside the <iframe> (if any) just use:

<a target="theRoster" href="xxx">change iframe contents</a>
<iframe name="theRoster"></iframe>

The iframe just needs a name and then the <a> element just needs to target that name.

You can also use <form>s with targets:

<form target="theRoster" action="showFullRoster.php" method="post">...

07-19-2012, 07:46 AM
I'm trying to dynamically load only the content inside of a single div. Within this div is other div's, widgets, etc... I don't see how I can use an iframe for this. Could you provide me some examples that are specific to my case?

Old Pedant
07-19-2012, 09:42 PM
To load the content into a <div>, you'll need to use AJAX.

I believe, though, that jQuery has this capability built in. (Loading a URL into a <div>, that is.) If not, google for a jQuery function that will do so.

It's not clear to me why you couldn't use an <iframe> inside your <div>, but if you say you can't, I guess you can't.