BetaCodeShareBeta

by Code Solutions Project

Simple solutions for common problems

PHP
Kprkpr
//index.php

<div id="table"></div>

<script>
	setInterval(refreshTable,30000);
		function refreshTable{
			conexion = new XMLHttpRequest();
			// Preparar la funcion de respuesta
			conexion.onreadystatechange = function() {  /* Mostrar */
			if(conexion.readyState == 4 && conexion.status == 200) {
							document.getElementById('table').innerHTML = conexion.responseText;
					}
			}
			// Realizar peticion HTTP
			conexion.open('POST', rootplace+'ajax.php');
			conexion.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

			conexion.send("see=statustable");
		}
</script>

//ajax.php
<?php
if ($_POST['statustable']){
    return "<table><tr><td>Hello</td></tr></table>";
}
PHP
Kprkpr
//index.php

<div id="table"></div>

<script>
	setInterval(refreshTable,30000);
		function refreshTable{
			conexion = new XMLHttpRequest();
			// Preparar la funcion de respuesta
			conexion.onreadystatechange = function() {  /* Mostrar */
			if(conexion.readyState == 4 && conexion.status == 200) {
							document.getElementById('table').innerHTML = conexion.responseText;
					}
			}
			// Realizar peticion HTTP
			conexion.open('POST', 'https://example.org/ajax.php');
			conexion.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

			conexion.send("see=statustable");
		}
</script>

//ajax.php
<?php
if ($_POST['statustable']){
    return "<table><tr><td>Hello</td></tr></table>";
}
×Oh snap! Something wrong