Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Problema con resultado Ajax + Asp

Estas en el tema de Problema con resultado Ajax + Asp en el foro de Frameworks JS en Foros del Web. 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 ...
  #1 (permalink)  
Antiguo 06/03/2008, 12:58
Avatar de Epunamun  
Fecha de Ingreso: noviembre-2004
Mensajes: 133
Antigüedad: 19 años, 5 meses
Puntos: 0
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/03/2008 a las 13:41 Razón: XD no habia cambiado mi servidor.
  #2 (permalink)  
Antiguo 11/03/2008, 12:21
Avatar de Epunamun  
Fecha de Ingreso: noviembre-2004
Mensajes: 133
Antigüedad: 19 años, 5 meses
Puntos: 0
Re: Problema con resultado Ajax + Asp

que estoy haciendo mal?????? ayuda plz
  #3 (permalink)  
Antiguo 08/04/2008, 10:00
 
Fecha de Ingreso: mayo-2006
Mensajes: 35
Antigüedad: 17 años, 11 meses
Puntos: 0
Re: Problema con resultado Ajax + Asp

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


Donde tienes esas Funciones???



segúin tu codigo no aparecen..
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:24.