Ver Mensaje Individual
  #2 (permalink)  
Antiguo 04/01/2011, 06:27
Avatar de masterpuppet
masterpuppet
Software Craftsman
 
Fecha de Ingreso: enero-2008
Ubicación: Montevideo, Uruguay
Mensajes: 3.550
Antigüedad: 16 años, 3 meses
Puntos: 845
Respuesta: jQuery $.ajax y PHP con un CSV

Que tal jesusjj, la función productsCatalog deberia retornar la estructura

Código PHP:
Ver original
  1. function productsCatalog($clave, $fichero)
  2. {
  3.     ....
  4.     return $categorias;    
  5. }

luego deberias devolverlo en formato json o bien html (mi ej es con json)

Código PHP:
Ver original
  1. if(isset($_POST['pag'])
  2.      && ($_POST['pag'] == 'products')
  3.           && isset($_POST['clave'])) {
  4.     $clave = $_POST['clave'];    
  5.     echo json_encode(productsCatalog($clave, 'products'));    
  6. }

y por ultimo manipularlo en el callback

Código Javascript:
Ver original
  1. $.post('index.php', { pag:'products',  clave: popID }, function(data){
  2.        //aqui deberias manipular la respuesta
  3. });

Saludos.