Ver Mensaje Individual
  #6 (permalink)  
Antiguo 12/09/2013, 18:29
Erick_MD9
 
Fecha de Ingreso: julio-2013
Ubicación: México
Mensajes: 361
Antigüedad: 10 años, 9 meses
Puntos: 55
Respuesta: Problema con Ajax y Php

Hola, prueba así.

Código Javascript:
Ver original
  1. function prueba2(pagina){
  2.         //Obtenemos el valor de la caja de texto, del tipo de consulta y del div
  3.         var textb = document.getElementById('txtb').value;
  4.         var tipos = document.getElementById('tipo').value;
  5.         var contenedor = document.getElementById('resultados');
  6.             // creamos un nuevo objeto de Ajax
  7.         ajax=nuevoAjax();
  8.         //usamos el metodo get
  9.         ajax.open("GET",pagina+"?valor="+textb+" & tipo="+tipos,true);
  10.         ajax.send();//PRIMERO DEBES ENVIAR LA PETICION
  11.         ajax.onreadystatechange = function() {
  12.             if (peticion.readyState == 4 && (peticion.status == 200 || window.location.href.indexOf ("http") == - 1)){//OJO, EL ULTIMO PARAMETRO ES POR SI ESTAS PROBANDO EN MODO LOCAL
  13.                 var textoAjax=ajax.responseText;
  14.                            contenedor.innerHTML=textoAjax;//
  15.             }
  16.         }
  17.     }

En esta página, al final deje unas funciones de ajax y uso básico, igual y te sirve.
http://www.forosdelweb.com/f18/pasar...x-php-1070906/

Saludos