My question is: I found such a simple ajax script (post in header):
[code=php]<script type=”text/javascript”>
function include(id, file){
var req;
req = new XMLHttpRequest();
req.onreadystatechange = function(){
if (req.readyState == 4){
if (req.status == 200){
document.getElementById(id).innerHTML = req.responseText;
} else {
document.getElementById(id).innerHTML = “There was an error… =(“;
}
}
};
req.open(“GET”, file, true);
req.send(null);
}
</script>
It’s wrote to put:
[code=php]<script type=”text/javascript”>
include(“div”, “file.php”);
</script>
in place where content had to be changed.
Let’s say I have to include file “test.html” into DIV with id=”test”. How I should change previous script to make it work?