Ver Mensaje Individual
  #6 (permalink)  
Antiguo 23/09/2011, 07:17
Avatar de lexus
lexus
 
Fecha de Ingreso: enero-2002
Ubicación: Cali - Colombia
Mensajes: 2.234
Antigüedad: 22 años, 3 meses
Puntos: 4
Respuesta: contador de usuarios inscritos con ajax

hola intente de esta forma pero no logro ver nada en pantalla que sera qeu estoy haciendo mal..
esta pagina la llamo principal.asp
Código HTML:
Ver original
  1. <html xmlns="[URL]http://www.w3.org/1999/xhtml[/URL]">
  2. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  3. <title>Documento sin título</title>
  4. <script type="text/javascript">
  5. function peticionAjax(urlPeticion) {
  6. var res = '';
  7. var ajax = false;
  8. try {
  9. ajax = new ActiveXObject("Msxml2.XMLHTTP");
  10. } catch (e) {
  11. try {
  12. ajax = new ActiveXObject("Microsoft.XMLHTTP");
  13. } catch (E) {
  14. ajax = false;
  15. }
  16. }
  17. if (!ajax && typeof XMLHttpRequest != 'undefined') {
  18. ajax = new XMLHttpRequest();
  19. }
  20. var url = urlPeticion;
  21. ajax.open("POST", url, false);
  22. ajax.setRequestHeader('Content-Type',
  23. 'application/x-www-form-urlencoded; charset=UTF-8');
  24. ajax.onreadystatechange = function() {
  25. if (ajax.readyState == 4) {
  26. var res = ajax.responseText;
  27. var xhr_data = res.substring(res.indexOf('<etiquetaElementoXML>'), res.indexOf('</etiquetaElementoXML>'));
  28. xhr_data = xhr_data.substring(xhr_data.indexOf('>'), xhr_data.indexOf('</'));
  29. if (!isNaN(xhr_data)) {
  30. document.getElementById('idContador').value=xhr_data;
  31. }
  32. setTimeout( function() { peticionAjax(url);}, 5000);
  33. }
  34. }
  35. ajax.send();
  36. }
  37. setTimeout(function() { peticionAjax("contador.asp?nocache=<%=now()%>"); }, 5000);
  38. </head>
  39. <body><div id="idContador"></div>
  40. </body>
  41. </html>

esta pagina la llamo contador.asp
Código HTML:
Ver original
  1. <?xml version="1.0"?>
  2. <numeroRegistros>
  3. <etiquetaElementoXML>6</etiquetaElementoXML>
  4. </numeroRegistros>
__________________
Control de Visitantes, Control de Accesos, Minutas digitales, Manejo de Correspondencia
http://www.controldevisitantes.com