AJAX - AJAX Frames

 
Vista:

AJAX Frames

Publicado por Ricardo WZ (1 intervención) el 05/09/2007 23:49:05
Tengo un problema con un Frame y Ajax. Mi Pagina tiene 4 frames, pero en Principal en donde actualizo datos a traves de AJAX (funciona correcto) pero cuando le doy clic a otra opcion donde deberia actualizarse el frame Principal me abre una nueva ventana como si perdiera el foco. Espero me puedan ayudar o sea explicito en la Pregunta. Cualquier cosa me escriben.

Ricar2

El codigo de la consulta es:

// stores the reference to the XMLHttpRequest object
var xmlHttp = createXmlHttpRequestObject();
// retrieves the XMLHttpRequest object
function createXmlHttpRequestObject()
{
// will store the reference to the XMLHttpRequest object
var xmlHttp;
// if running Internet Explorer
if(window.ActiveXObject)
{
try
{
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
xmlHttp = false;
}
}
// if running Mozilla or other browsers
else
{
try
{
xmlHttp = new XMLHttpRequest();
}
catch (e)
{
xmlHttp = false;
}
}
// return the created object or display an error message
if (!xmlHttp)
alert("Error creando el objeto XMLHttpRequest.");
else
return xmlHttp;
}
// make asynchronous HTTP request using the XMLHttpRequest object
function process()
{
// proceed only if the xmlHttp object isn't busy
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
{
// retrieve the name typed by the user on the form
name = encodeURIComponent(document.getElementById("TxtCedula").value);
// execute the quickstart.php page from the server
xmlHttp.open("GET", "quickstart.php?TxtCedula=" + name, true);
// define the method to handle server responses
xmlHttp.onreadystatechange = handleServerResponse;
// make the server request
xmlHttp.send(null);
}
else
// if the connection is busy, try again after one second
setTimeout('process()', 1000);
}
// executed automatically when a message is received from the server
function handleServerResponse()
{
// move forward only if the transaction has completed
if (xmlHttp.readyState == 4)
{
// status of 200 indicates the transaction completed successfully
if (xmlHttp.status == 200)
{
// extract the XML retrieved from the server
xmlResponse = xmlHttp.responseXML;
// obtain the document element (the root element) of the XML struct
xmlDocumentElement = xmlResponse.documentElement;
// get the text message, which is in the first child of
// the the document element
helloMessage = xmlDocumentElement.firstChild.data;
// update the client display using the data received from the serve
//document.getElementById("divMessage").innerHTML =
//document.getElementById("divMessage").innerHTML =
//'' + helloMessage + '';
document.f1.TxtNombre.value = helloMessage;
// restart sequence
setTimeout('process()', 1000);
}
}
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 30
Ha mantenido su posición en AJAX (en relación al último mes)
Gráfica de AJAX

RE:AJAX Frames

Publicado por Yamil Bracho (184 intervenciones) el 07/09/2007 16:44:37
Creo que tienes que usar

window.frames[0].f1.TxtNombre.value = helloMessage; // Si es el primer frame
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar