<script>function functions(){
document.getElementById("id").innerHTML='<center>در حال ساخت ...</center>';
var xmlhttp=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject('Microsoft.XMLHTTP');
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4 && xmlhttp.status==200){
code=xmlhttp.responseText;
document.getElementById("id").innerHTML=code;
}
}
xmlhttp.open('get','/posts',true);
xmlhttp.send();
}
</script>
<button onclick="functions();">بساز</button><br>
<div id="id"></div>