Ver Mensaje Individual
  #71 (permalink)  
Antiguo 14/08/2009, 09:18
emilans
 
Fecha de Ingreso: agosto-2009
Mensajes: 2
Antigüedad: 14 años, 8 meses
Puntos: 0
Respuesta: MiniChat con PHP/MySQL/AJAX v2.0

Logre hacerlo es solo cuestion de pensar pensar y pensar

esta es la modificacion

function fajax()
{
var comentario;
comentario = document.getElementById('comentario').value;
var monto;
monto = document.getElementById('monto').value;
var ajax;
ajax = new ajaxFunction();

ajax.open("POST","?Enviar=si",true);
ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajax.send("comentario="+comentario+"&monto="+monto );

document.getElementById('comentario').value="";
document.getElementById('comentario').focus();

document.getElementById('monto').value="";
document.getElementById('monto').focus();
fajax3();

}

y en el html

<script type="text/javascript">
document.getElementById('comentario').value="";
document.getElementById('comentario').focus();

document.getElementById('monto').value="";
document.getElementById('monto').focus();

fajax3();
</script>


en la parte del GET

if($_GET["Enviar"]=="si")
{
$max="select max(id) from chat";
$max=mysql_query($max);
$max=mysql_result($max,0,0)+1;
$fecha=date("Y/m/d");
$tiempo=date("H:i:s");
$estado="espera";

$insert="insert into chat values(".$max.",'".htmlentities(utf8_decode($_REQU EST["comentario"]))."','".htmlentities(utf8_decode($_REQUEST["monto"]))."','".$fecha."','".$tiempo."','".$usuario."','" .$operador."','".$estado."')";
if(trim($_REQUEST["comentario"])!=NULL && trim($_REQUEST["monto"])!=NULL)
{
$insert=mysql_query($insert);
}
exit();
}