SHARE
TWEET

Jquery + Json - Estdos e Cidades brasileiras

MarcosNakamine Jul 7th, 2016 (edited) 311 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Document</title>
  6.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  7. <script>
  8.     // http://labs.myn.com.br/2012/12/json-cidades-e-estados-brasileiros.html
  9.     $(function(){
  10.         $.ajax({
  11.             dataType: "json", // define o tipo de arquivo
  12.             url: 'estados.json', // arquivo contendo os dados do json
  13.             success: function(e){ // quando o arquivo terminar de fazer download executa essa função
  14.                 console.log(e.estados[0].sigla);
  15.                 console.log(e.estados[0].nome);
  16.             }
  17.         });
  18.     });
  19. </script>
  20. </head>
  21. <body>
  22.  
  23. </body>
  24. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top