RE:ayuda para llecar una caja de texto con ajax
hola chicos ya hice mis consultas todo ya me muestra el ultimo numero de cada tipo de documento pero no lo envia dentro del div nose porq los nombres estan bien haber si me puede ayudar porfis ahi les va mi codigo
funciones de ajax........................
function ajaxFunction()
{
var xmlhttp=false;
try {
// Creación del objeto ajax para navegadores diferentes a Explorer
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
// o bien
try {
// Creación del objet ajax para Explorer
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
function fajax()
{
var num,d1,ajax,comentarios;
comentarios = document.getElementById('comentarios');
d1 = document.getElementById('tipodocumento').value;
num = document.getElementById('numero').value;
ajax=ajaxFunction();
ajax.open("POST","proceso3.php",true);
ajax.onreadystatechange=function()
{ if (ajax.readyState==4)
{
if(ajax.status==200)
{
document.getElementById('comentarios').innerHTML=ajax.responseText;
}
}
else
if (ajax.readyState==1 || ajax.readyState==2 || ajax.readyState==3)
{
comentarios.innerHTML = 'Procesando...';
}
}
ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
ajax.send("d1="+d1+"&num_doc="+num);
}
***************proceso3.php****************
<?php
header("Content-type: text/html; charset=ISO-8859-1");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: Mon,26 Jul 1997 05:00:00 GMT");
$idtip_doc=$_POST['d1'];
$num_doc=$_POST['num_doc'];
$link= mysql_connect('localhost','root','');
$db_selected = mysql_select_db('controldocu', $link);
$sql="SELECT idtip_doc, MAX(num_doc) AS Maximo FROM reg_doc_emi WHERE idtip_doc='$idtip_doc' GROUP BY idtip_doc";
$resultado= mysql_query($sql);
while($row3=mysql_fetch_array($resultado))
{
$num_doc=$row3[1];
$num_doc=($num_doc + 1);
?>
<?}?>
NOTA: si aqui le agrego el input text funciona aparece el numero pero no me lo esta enviando a mi form
*************registrocorresponemitida.php***********************
<form name='Form' action='RegistroCorrespEmi.php' method='POST'>
<td width=100% height=50% valign=baseline>
<table cellspacing=5 cellpadding=7 border=0>
<br>
<h6><tr>CORRELATIVO SUPERIOR </tr>
<tr>
<br>
<tr>
<td>Tipo de Documento :</td>
<td width=30%> <select name="tipodocumento" size="1" id="tipodocumento" tabindex="5" onChange='fajax()'>
<option value="">------------------------------</option>
<?$resultado=tipodocumentorelacion();
while($row2 = mysql_fetch_array($resultado))
{?>
<option value="<? echo $row2[0];?>"><? echo $row2[1];?></option>
<? }?>
</select>
<tr>
<td>N° Correlativo Emisión :</td>
<div id="comentarios">
<td><input type="text" name="nume" id="numero" value='<?= $num_doc ?>' readonly ></td>
</div>
ESPERO ME PUEDAN AYUDAR