Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/11/2011, 14:33
Avatar de livemusic
livemusic
 
Fecha de Ingreso: abril-2011
Ubicación: Lima - Chorrillos
Mensajes: 150
Antigüedad: 13 años
Puntos: 18
Respuesta: Armar array con resultado de json

Suerte espero y te funcione ...

LiveMusic.html
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Documento sin título</title>
  5. <script src="http://www.google.com/jsapi"></script>  
  6. <script type="text/javascript">
  7.     google.load("jquery", "1.6.4");
  8. $(function(){
  9.     $.getJSON('valores.php',function(data){
  10.         var html = "<option value='' selected='selected'>LiveMusic && LiveCarito</option>";
  11.         for(var i = 0; i < data.length; i++){
  12.             html += "<option value='"+ (i+1) +"'>"+ data[i].live +"</option>";
  13.         }
  14.         $("#LiveMusic").append($(html));
  15.     })
  16. })
  17. </head>
  18.  
  19. <select id="LiveMusic">
  20.    
  21. </body>
  22. </html>




valores.php
Código PHP:
Ver original
  1. <?php
  2.     $powerCarito = array();
  3.     for($x=0; $x<=4; $x++){
  4.         $powerCarito[] = array("live" => "carito".($x+1));
  5.     }
  6.     echo json_encode($powerCarito);
  7. ?>