First some general javascript code:
Code:
<script type="text/javascript">
var myRequest;
function startXMLHttpRequest(url)
{
if (window.XMLHttpRequest)
{
myRequest = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
try { myRequest = new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{
try {myRequest= new ActiveXObject("Microsoft.XMLHTTP");}
catch(e) {myRequest=null;}
}
}
else
{
myRequest=null;
}
if (myRequest)
{
myRequest.onreadystatechange = processRequestChange;
myRequest.open("GET", url, true);
myRequest.send(null);
}
else
{
alert("The browser is not capable of this");
}
}
function processRequestChange()
{
// if the request is complete and successfull
if (myRequest.readyState == 4)
{
if ((myRequest.status == 200) || (myRequest.status == 304))
{
useResponse(myRequest.responseText);
}
else
{
alert("Can not access data:\n" + myRequest.statusText);
}
}
}
// This is the clue, where you do the work
function useResponse(content)
{
obj = document.getElementById("div_to_show_content");
obj.innerHTML = content;
}
</script>
Then you can do something like this:
Code:
<p style="cursor:pointer" onclick="javascript:startXMLHttpRequest('your_link');return false;">
Click here
</p>
<div id="div_to_show_content">This text is replace by the content from the link</div>
This will display the hole content from the url "your_link" into the div with id "div_to_show_content".
I think this should get you started.