0

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!

3
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by LaxLoafer
0

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

Hello to you too!

Ajaxnewbie,

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...

<html>
<head>
<title></title>
<script type="text/javascript">
function myClick(link, frameId) {
	var theFrame = document.getElementById(frameId);
	theFrame.style.display = "block";
	theFrame.src = link.href;
}
</script>
</head>
<body>
<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>
</body>
</html>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.