Ver Mensaje Individual
  #8 (permalink)  
Antiguo 16/10/2013, 06:34
quimfv
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 16 años, 1 mes
Puntos: 574
Respuesta: Leer un json desde una url y no desde un archivo

http://www.w3schools.com/jquery/ajax_getjson.asp

jquery... no es que sea de mi admiración...

Código Javascript:
Ver original
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
  5. </script>
  6. <script>
  7. $(document).ready(function(){
  8.   $("button").click(function(){
  9.     $.getJSON("http://pere.bocairent.net/z39.php?title=caballos",function(result){
  10.       $.each(result, function(i, field){
  11.         $("div").append(field + " ");
  12.       });
  13.     });
  14.   });
  15. });
  16. </script>
  17. </head>
  18. <body>
  19.  
  20. <button>Get JSON data</button>
  21. <div></div>
  22.  
  23. </body>
  24. </html>
__________________
Quim
--------------------------------------------------
Ayudar a ayudar es una buena práctica!!! Y da buenos resultados.