Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/09/2011, 14:40
Lanix_0
 
Fecha de Ingreso: noviembre-2010
Mensajes: 95
Antigüedad: 13 años, 5 meses
Puntos: 5
Exclamación Error al recibir datos en ajax

Hola que tal amigos vengo con esta otra duda estoy tratando de recibir un dato por medio de un XML según yo todo esta bien pero me regresa un valor* ‘undefined’
que es lo que pasa les incluyo el codigo AJAX
*
function createAjax()
{*
*** var xmlhttp=false;*
*** try*
*** {*
******* xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");*
*** }
*** catch(e)
*** {*
******* try
******* {*
*********** xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");*
******* }*
******* catch(E) { xmlhttp=false; }
*** }
** *if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); }*
*** return xmlhttp;*
}
*
function login_ajax()
{
********* var this_objectUser = document.getElementById("txtUser");
********* var this_objectPass = document.getElementById("txtPassword");
********* ajax = createAjax();
********* ajax.open("POST", "../cfiniquitos/doc_php/src/startsession.php", true);
********* ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
********* ajax.send("user_id="+this_objectUser);
********* ajax.onreadystatechange=function()
*** {
*** ***** if (ajax.readyState==4)
******* {
******* * if (ajax.status == 200)
******* * {
********* ******* *** var datagrid = ajax.responseXML.getElementsByTagName("user")[0];
********* ******* *** var user = datagrid.childNodes[0].data;
********* ******* *** alert(user);
********* ******* *** clared_txt();
********* ******* }
******* }
*** }
*********
}
*
*
y el codigo XML
*
date_default_timezone_set('America/Mexico_City');
include("../lib/db_connect.php");
$query_id = mysql_query("SELECT * FROM tbuser WHERE id_user = '15272874' AND password = '0'",$db_connect) or die ("Error #0001: Error query line (6)");
********* $xml="<?xml version='1.0' encoding='ISO-8859-1'?>";
*********
********* $user_name = mysql_result($query_id,0,"name");
********* $xml.="<user>";
********************* $xml.="<user_id><![CDATA[$user_name]]></user_id>";
********* $xml.="</user>";
header("Content-type: text/xml");
echo $xml;