Home
Login
·
Signup
Home
»
xyz
»
123
»
test
» View post
Graham
This is a test of a script for displaying a forum thread on the home page using XHR javascript
If XHR is not supported normal forum should load
<div id="content" style="display:none"> <!--content--><xt:forum /><!--content--> </div>
And then this
<script> var thisPath = window.location.pathname; // Adjust path to suit if (thisPath == "/" || thisPath == "/index" && typeof ( new XMLHttpRequest())!=undefined){ // Change this for your own url newPath = "/index/__xt/test/thread-oon8wg4ki2cqrt9e1bcdih8qa4ec2wkln9y1.html"; function loadContent(){ var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function(){ if (this.readyState == 4 && this.status == 200){ var content=this.responseText.split("<!--content-->"); document.getElementById("content").innerHTML = content[1]; document.getElementById("content").style.display = "block";}} xhttp.open("GET", newPath, true); xhttp.send();} loadContent();} else{ document.getElementById("content").style.display = "block";} </script>
#
2014-04-12 05:43 (edited 2018-03-11 23:48 by
Graham
) ·
(0)
Home
»
xyz
»
123
»
test
» View post
Online: Guests: 1
Log in