Hi there!

Okay, here is my scenario:

I have a link and a div on a webpage. With the link I want to toggle the content (HTML) of the div. On toggle, I want to load the content from a PHP-file and I want it to load on the toggle, not when the webpage originally loaded (to reduce loading time on the webpage itself).

The file that is loaded on toggle doesn't have to be PHP, but it would help a lot.

Does anybody know of a example of this or something similar to it? I have been looking for some time now, without any luck unfortunately. :icon_frown:

Highly appreciate any help/answers/feedback!

Hi there!...
Does anybody know of a example...

Hello to you too!


There are some AJAX examples to be found on w3schools.com that you might find useful. See: AJAX Examples

Using AJAX is useful if you wish to import snippets of information. For loading entire web pages, the following approach using IFrames should do the trick...

<script type="text/javascript">
function myClick(link, frameId) {
	var theFrame = document.getElementById(frameId);
	theFrame.style.display = "block";
	theFrame.src = link.href;
<a href="http://www.example.com/" onclick="myClick(this,'frame1'); return false;">Click here!</a>
<iframe id="frame1" style="display: none;" src="http://about:blank" width="300" height="200"></iframe>