Retroceder   Foros del Web > Programación para sitios web > AJAX

Respuesta
 
Herramientas Desplegado
Antiguo 06-mar-2008, 11:58   #1 (permalink)
Epunamun está en el buen camino
 
Avatar de Epunamun
 
Fecha de Ingreso: noviembre-2004
Mensajes: 101
Enviar un mensaje por MSN a Epunamun
Problema con resultado Ajax + Asp

Amigos tengo el siguiente problemilla, con el rut de un cliente deseo saber si se encuentra en la bd, si esta que despliegue los datos y ademas al formulario añada un select y un par de inputs, si no esta que sala un mensaje de error. Lamentablemente no he podido hacer que me muestre los datos.... no se donde esta el error haber si me echan una mano si....


html
Cita:
<form action="#" name="sac01">
<Table width="336" bgcolor="#C0C0C0">
<tr>
<td colspan="3">
<p style="color:#FFFFFF"><b>Ingreso de Operadores S.A.C.</b></p>
</td>
</tr>
<tr>
<td width="80">
<B><FONT face="Tahoma" color="#626262" size="2">RUT:</FONT></B>
</td>
<td width="164">
<INPUT NAME="rut" id='rut' style="background-color:#6699CC;color:#FFFFFF;height:15px" onKeyPress="LP_data()" onKeyUp="validar(this.form)" TYPE="text" maxlength ="8"><FONT face="Tahoma" color="FFFFFF" size="2">-</FONT>
<INPUT TYPE="text" id="dig" NAME="dig" size="1" readonly="True" style=" background-color:#999999;color:#FFFFFF;height:15px" maxlength ="1">
</td>
<td width="76" align="center">
<input type="image" alt="Busca RUT" src="http://www.forosdelweb.com/images/reload.gif" onclick="verificaUsuario();" />
</td>
</tr>
<div id="capaContenedora">
</div>
</Table>
</form>
ajax
Cita:
<script language="javascript" type="text/javascript">
function handleHttpResponse() {
if (http.readyState == 4) {
//carga de Datos
document.getElementById('Layer1').style.display = 'Block';
document.getElementById('Layer2').style.display = 'Block';
alert('cargo');

if (http.status == 200) {
if (http.responseText.indexOf('invalid') == -1) {
// Armamos un array, usando la coma para separar elementos
document.getElementById('Layer1').style.display = 'none';
document.getElementById('Layer2').style.display = 'none';
alert('pasa');
results = http.responseText.split(",");
document.getElementById("datos").innerHTML = results[0] ;
enProceso = false;
}
}
}
}

function verificaUsuario() {
if (!enProceso && http) {
var rut = escape(document.getElementById("rut").value);
var dv = escape(document.getElementById("dig").value);
var url = "operador.asp?rut="+ rut +"&dv="+ dv ;
http.open("GET", url, true);
http.onreadystatechange = handleHttpResponse;
enProceso = true;
http.send(null);
}
}

function getHTTPObject() {
var xmlhttp;
/*@cc_on
@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) { xmlhttp = false; }
}
@else
xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) { xmlhttp = false; }
}
return xmlhttp;
}

var enProceso = false; // lo usamos para ver si hay un proceso activo
var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest
asp
Cita:
<%rut = request.QueryString("rut")
dv = request.QueryString("dig")
rut = rut &"-" & dv
sql="SELECT nombrefuncionario, sucursal, d_unidad, mailfuncionario FROM funcionarios WHERE rut_funcionario='" & rut & "'"

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=SQLOLEDB; Data Source = miservidor ; Initial Catalog = mibd; User Id =XXX; Password=XXX;"
set rs = CreateObject("ADODB.Recordset")
rs.Open sql, conn
if not rs.eof
response.write(Rs.fields("NombreFuncionario"))
else
response.Write("<p style='color:##FF0000'>Lo Sentimos Usuario No se encuentra en la Tabla de Funcionarios</p>")
end if
%>

Última edición por Epunamun; 06-mar-2008 a las 12:41. Razón: XD no habia cambiado mi servidor.
Epunamun está desconectado   Responder Citando
Antiguo 11-mar-2008, 12:21   #2 (permalink)
Epunamun está en el buen camino
 
Avatar de Epunamun
 
Fecha de Ingreso: noviembre-2004
Mensajes: 101
Enviar un mensaje por MSN a Epunamun
Re: Problema con resultado Ajax + Asp

que estoy haciendo mal?????? ayuda plz
Epunamun está desconectado   Responder Citando
Antiguo 08-abr-2008, 10:00   #3 (permalink)
cristian.mbb ha deshabilitado el karma
 
Fecha de Ingreso: mayo-2006
Mensajes: 35
Re: Problema con resultado Ajax + Asp

onKeyPress="LP_data()" onKeyUp="validar(this.form)"


Donde tienes esas Funciones???



segúin tu codigo no aparecen..
cristian.mbb está desconectado   Responder Citando
Respuesta
No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 04:37.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93