Ver Mensaje Individual
  #12 (permalink)  
Antiguo 24/03/2011, 01:58
principiante2011
 
Fecha de Ingreso: marzo-2011
Mensajes: 14
Antigüedad: 13 años, 1 mes
Puntos: 0
Respuesta: Actualizar web con ajax

hola amigos he conseguido hacer este ejemplo http://prueba.centerhipico.com/ y me a funcionado ahora me gustaria aprender a refrescar la web sin tener que actualizar los usuarios , he echo alguna prueba pero me falta el codigo load .

ejemplo

idex html


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Prueba de Funcionamiento AJAX</title>
<!-- AQUI SE COLOCA LA RUTA DONDE SE ENCUENTRA EL ARCHIVO
AJAX.JS EN ESTE CASO ESTA EN LA MISMA CARPETA QUE LOS OTROS ARCHIVOS -->
<script type="text/javascript" src="ajax.js"></script>
</head>
<script type="text/javascript" src="load.js"></script>
</head>
<body>


onload="load()">
<div id="paginaweb">
<table id="web" border="0">







ahora hice otro codigo llamado ajax.js

//ESTA PRIMERA PARTE DEL CODIGO SE HACE PARA CREAR EL OBJETO EN AJAX Y FUNCIONE EN LOS EXPLORADORES
function objetoAjax(){
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;
}
//AQUI TERMINA ESTA FUNCION QUE NO CAMBIA


//ESTA FUNCIONE SI PUEDE CAMBIAR SEGUN SEA EL CASO
function mostrarNombre(nombre){
//donde se mostrará el resultado de la eliminacion
divResultado = document.getElementById('respuesta_ajax');


//instanciamos el objetoAjax
ajax=objetoAjax();
//uso del medotod GET
ajax.open("GET", "prueba_ajax.php?nombre="+nombre);
ajax.onreadystatechange=function() {

if (ajax.readyState==4) {
//mostrar resultados en esta capa
divResultado.innerHTML = ajax.responseText
}
}
//como hacemos uso del metodo GET
//colocamos null
ajax.send(null)
}




ahora hay que crear el archivo llamado load.js que sera e encargado de actualizar la web cuando yo le mande pero lo he buscado y no se cual es me lo podias pasar porfavor y decirme si voy bien encaminado o tengo algun error saludos y gracias de antemano